Skip to content

Commit c2e04d3

Browse files
committed
banman: Add, use CBanEntry ctor that takes ban reason
1 parent 1ffa4ce commit c2e04d3

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/addrdb.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ class CBanEntry
4343
nCreateTime = nCreateTimeIn;
4444
}
4545

46+
explicit CBanEntry(int64_t n_create_time_in, BanReason ban_reason_in) : CBanEntry(n_create_time_in)
47+
{
48+
banReason = ban_reason_in;
49+
}
50+
4651
ADD_SERIALIZE_METHODS;
4752

4853
template <typename Stream, typename Operation>

src/banman.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,7 @@ void BanMan::Ban(const CNetAddr& netAddr, const BanReason& banReason, int64_t ba
102102

103103
void BanMan::Ban(const CSubNet& subNet, const BanReason& banReason, int64_t bantimeoffset, bool sinceUnixEpoch)
104104
{
105-
CBanEntry banEntry(GetTime());
106-
banEntry.banReason = banReason;
105+
CBanEntry banEntry(GetTime(), banReason);
107106

108107
int64_t normalized_bantimeoffset = bantimeoffset;
109108
bool normalized_sinceUnixEpoch = sinceUnixEpoch;

0 commit comments

Comments
 (0)