diff options
| author | Pieter Wuille <[email protected]> | 2020-06-10 17:11:38 -0700 |
|---|---|---|
| committer | Pieter Wuille <[email protected]> | 2020-07-03 20:43:55 -0700 |
| commit | 2ad58381fffb33d611abf900b73d9e6b5a4e35f8 (patch) | |
| tree | 8794dd741e4616bcf129da6e274a822a9952e53b /src/addrdb.h | |
| parent | Replace automatic bans with discouragement filter (diff) | |
| download | discoin-2ad58381fffb33d611abf900b73d9e6b5a4e35f8.tar.xz discoin-2ad58381fffb33d611abf900b73d9e6b5a4e35f8.zip | |
Clean up separated ban/discourage interface
Diffstat (limited to 'src/addrdb.h')
| -rw-r--r-- | src/addrdb.h | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/src/addrdb.h b/src/addrdb.h index c6d4307d6..8410c3776 100644 --- a/src/addrdb.h +++ b/src/addrdb.h @@ -17,13 +17,6 @@ class CSubNet; class CAddrMan; class CDataStream; -typedef enum BanReason -{ - BanReasonUnknown = 0, - BanReasonNodeMisbehaving = 1, - BanReasonManuallyAdded = 2 -} BanReason; - class CBanEntry { public: @@ -31,7 +24,6 @@ public: int nVersion; int64_t nCreateTime; int64_t nBanUntil; - uint8_t banReason; CBanEntry() { @@ -44,31 +36,17 @@ public: nCreateTime = nCreateTimeIn; } - explicit CBanEntry(int64_t n_create_time_in, BanReason ban_reason_in) : CBanEntry(n_create_time_in) + SERIALIZE_METHODS(CBanEntry, obj) { - banReason = ban_reason_in; + uint8_t ban_reason = 2; //! For backward compatibility + READWRITE(obj.nVersion, obj.nCreateTime, obj.nBanUntil, ban_reason); } - SERIALIZE_METHODS(CBanEntry, obj) { READWRITE(obj.nVersion, obj.nCreateTime, obj.nBanUntil, obj.banReason); } - void SetNull() { nVersion = CBanEntry::CURRENT_VERSION; nCreateTime = 0; nBanUntil = 0; - banReason = BanReasonUnknown; - } - - std::string banReasonToString() const - { - switch (banReason) { - case BanReasonNodeMisbehaving: - return "node misbehaving"; - case BanReasonManuallyAdded: - return "manually added"; - default: - return "unknown"; - } } }; |