Skip to content

Commit 33c4e36

Browse files
committed
refactor: rename day_of_blocks to PLATFORM_BAN_WINDOW_BLOCKS
1 parent 4b4bcfd commit 33c4e36

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/net_processing.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3567,13 +3567,13 @@ MessageProcessingResult PeerManagerImpl::ProcessPlatformBanMessage(NodeId node,
35673567
ret.m_error = MisbehavingError{100};
35683568
return ret;
35693569
}
3570-
constexpr int day_of_blocks = 576;
3570+
static constexpr int PLATFORM_BAN_WINDOW_BLOCKS = 576;
35713571
int tipHeight = WITH_LOCK(cs_main, return m_chainman.ActiveChainstate().m_chain.Height());
3572-
if (tipHeight < ban_msg.m_requested_height || tipHeight - day_of_blocks > ban_msg.m_requested_height) {
3573-
// m_requested_height is inside the range [TipHeight - 576 - 5, TipHeight + 5]
3572+
if (tipHeight < ban_msg.m_requested_height || tipHeight - PLATFORM_BAN_WINDOW_BLOCKS > ban_msg.m_requested_height) {
3573+
// m_requested_height is inside the range [TipHeight - PLATFORM_BAN_WINDOW_BLOCKS - 5, TipHeight + 5]
35743574
LogPrintf("PLATFORMBAN -- hash: %s protx_hash: %s unexpected height: %d tip: %d\n", hash.ToString(), ban_msg.m_protx_hash.ToString(), ban_msg.m_requested_height, tipHeight);
3575-
if (tipHeight + 5 < ban_msg.m_requested_height || tipHeight - day_of_blocks - 5 > ban_msg.m_requested_height) {
3576-
// m_requested_height is outside the range [TipHeight - 576 - 5, TipHeight + 5]
3575+
if (tipHeight + 5 < ban_msg.m_requested_height || tipHeight - PLATFORM_BAN_WINDOW_BLOCKS - 5 > ban_msg.m_requested_height) {
3576+
// m_requested_height is outside the range [TipHeight - PLATFORM_BAN_WINDOW_BLOCKS - 5, TipHeight + 5]
35773577
ret.m_error = MisbehavingError{10};
35783578
return ret;
35793579
}

0 commit comments

Comments
 (0)