mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 07:09:15 +01:00
Merge bitcoin/bitcoin#25480: Replace CountSecondsDouble with Ticks<SecondsDouble>
fa956e7508Replace CountSecondsDouble with Ticks<SecondsDouble> (MacroFake) Pull request description: Seems odd to have two ways to say exactly the same thing when one is sufficient. ACKs for top commit: fanquake: ACKfa956e7508shaavan: ACKfa956e7508w0xlt: ACKfa956e7508Tree-SHA512: b599470e19b693da1ed1102d1e86b08cb03adaddf2048752b6d050fdf86055be117ff0ae10b6953d03e00eaaf7b0cfa350137968b67d6c5b3ca68c5aa50ca6aa
This commit is contained in:
@@ -3019,7 +3019,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
|
||||
if (peer->m_addr_token_bucket < MAX_ADDR_PROCESSING_TOKEN_BUCKET) {
|
||||
// Don't increment bucket if it's already full
|
||||
const auto time_diff = std::max(current_time - peer->m_addr_token_timestamp, 0us);
|
||||
const double increment = CountSecondsDouble(time_diff) * MAX_ADDR_RATE_PER_SECOND;
|
||||
const double increment = Ticks<SecondsDouble>(time_diff) * MAX_ADDR_RATE_PER_SECOND;
|
||||
peer->m_addr_token_bucket = std::min<double>(peer->m_addr_token_bucket + increment, MAX_ADDR_PROCESSING_TOKEN_BUCKET);
|
||||
}
|
||||
peer->m_addr_token_timestamp = current_time;
|
||||
|
||||
Reference in New Issue
Block a user