diff options
| author | Carl Dong <[email protected]> | 2019-01-03 21:26:10 +0800 |
|---|---|---|
| committer | Carl Dong <[email protected]> | 2019-01-16 13:54:18 -0500 |
| commit | c2e04d37f3841d109c1fe60693f9622e2836cc29 (patch) | |
| tree | 3c47144e669133047f96c5df6b61acf997d6e178 /src | |
| parent | banman: reformulate nBanUtil calculation (diff) | |
| download | discoin-c2e04d37f3841d109c1fe60693f9622e2836cc29.tar.xz discoin-c2e04d37f3841d109c1fe60693f9622e2836cc29.zip | |
banman: Add, use CBanEntry ctor that takes ban reason
Diffstat (limited to 'src')
| -rw-r--r-- | src/addrdb.h | 5 | ||||
| -rw-r--r-- | src/banman.cpp | 3 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/addrdb.h b/src/addrdb.h index 88da31a6f..290b63dd1 100644 --- a/src/addrdb.h +++ b/src/addrdb.h @@ -43,6 +43,11 @@ public: nCreateTime = nCreateTimeIn; } + explicit CBanEntry(int64_t n_create_time_in, BanReason ban_reason_in) : CBanEntry(n_create_time_in) + { + banReason = ban_reason_in; + } + ADD_SERIALIZE_METHODS; template <typename Stream, typename Operation> diff --git a/src/banman.cpp b/src/banman.cpp index 19c8e3752..56cbe941c 100644 --- a/src/banman.cpp +++ b/src/banman.cpp @@ -102,8 +102,7 @@ void BanMan::Ban(const CNetAddr& netAddr, const BanReason& banReason, int64_t ba void BanMan::Ban(const CSubNet& subNet, const BanReason& banReason, int64_t bantimeoffset, bool sinceUnixEpoch) { - CBanEntry banEntry(GetTime()); - banEntry.banReason = banReason; + CBanEntry banEntry(GetTime(), banReason); int64_t normalized_bantimeoffset = bantimeoffset; bool normalized_sinceUnixEpoch = sinceUnixEpoch; |