aboutsummaryrefslogtreecommitdiff
path: root/src/net.h
diff options
context:
space:
mode:
authorJonas Schnelli <jonas.schnelli@include7.ch>2015-06-19 15:27:37 +0200
committerJonas Schnelli <jonas.schnelli@include7.ch>2015-07-02 20:29:36 +0200
commitf581d3d656cf269ea09ac6f130f4bd70b40a9e55 (patch)
treed598d6e1842273946fbbfb7b91744b9e6ca73c4b /src/net.h
parentd6db1157bcab7ace13f046bdfa107b456c1dfbe3 (diff)
downloadbitcoin-f581d3d656cf269ea09ac6f130f4bd70b40a9e55.tar.xz
banlist.dat: store banlist on disk
Diffstat (limited to 'src/net.h')
-rw-r--r--src/net.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/net.h b/src/net.h
index 69e4c592a9..42c859e460 100644
--- a/src/net.h
+++ b/src/net.h
@@ -287,6 +287,7 @@ protected:
// Key is IP address, value is banned-until-time
static std::map<CSubNet, int64_t> setBanned;
static CCriticalSection cs_setBanned;
+ static bool setBannedIsDirty;
// Whitelisted ranges. Any node connecting from these is automatically
// whitelisted (as well as those connecting to whitelisted binds).
@@ -613,6 +614,14 @@ public:
static bool Unban(const CNetAddr &ip);
static bool Unban(const CSubNet &ip);
static void GetBanned(std::map<CSubNet, int64_t> &banmap);
+ static void SetBanned(const std::map<CSubNet, int64_t> &banmap);
+
+ //!check is the banlist has unwritten changes
+ static bool BannedSetIsDirty();
+ //!set the "dirty" flag for the banlist
+ static void SetBannedSetDirty(bool dirty=true);
+ //!clean unused entires (if bantime has expired)
+ static void SweepBanned();
void copyStats(CNodeStats &stats);
@@ -644,4 +653,17 @@ public:
bool Read(CAddrMan& addr);
};
+/** Access to the banlist database (banlist.dat) */
+class CBanDB
+{
+private:
+ boost::filesystem::path pathBanlist;
+public:
+ CBanDB();
+ bool Write(const std::map<CSubNet, int64_t>& banSet);
+ bool Read(std::map<CSubNet, int64_t>& banSet);
+};
+
+void DumpBanlist();
+
#endif // BITCOIN_NET_H