From c2e04d37f3841d109c1fe60693f9622e2836cc29 Mon Sep 17 00:00:00 2001 From: Carl Dong Date: Thu, 3 Jan 2019 21:26:10 +0800 Subject: [PATCH] banman: Add, use CBanEntry ctor that takes ban reason --- src/addrdb.h | 5 +++++ src/banman.cpp | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/addrdb.h b/src/addrdb.h index 88da31a6fc3..290b63dd128 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 diff --git a/src/banman.cpp b/src/banman.cpp index 19c8e375235..56cbe941c68 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;