diff options
author | dergoegge <n.goeggi@gmail.com> | 2023-10-02 14:28:21 +0100 |
---|---|---|
committer | dergoegge <n.goeggi@gmail.com> | 2023-10-04 13:14:05 +0100 |
commit | 47520ed209d9341702a0fb6006bee6f63f7da42e (patch) | |
tree | ad1ef2ee0de1b0acecd3cd28a5769f805baee5c1 /src | |
parent | 77506f4ac6b3a3d7396a3a6101345019e05b3b10 (diff) |
[net processing] Make fee filter rounder non-global
Diffstat (limited to 'src')
-rw-r--r-- | src/net_processing.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp index ca8bd48225..b38965c0b8 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -697,6 +697,8 @@ private: FastRandomContext m_rng GUARDED_BY(NetEventsInterface::g_msgproc_mutex); + FeeFilterRounder m_fee_filter_rounder GUARDED_BY(NetEventsInterface::g_msgproc_mutex); + const CChainParams& m_chainparams; CConnman& m_connman; AddrMan& m_addrman; @@ -1811,6 +1813,7 @@ PeerManagerImpl::PeerManagerImpl(CConnman& connman, AddrMan& addrman, BanMan* banman, ChainstateManager& chainman, CTxMemPool& pool, Options opts) : m_rng{opts.deterministic_rng}, + m_fee_filter_rounder{CFeeRate{DEFAULT_MIN_RELAY_TX_FEE}}, m_chainparams(chainman.GetParams()), m_connman(connman), m_addrman(addrman), @@ -5338,14 +5341,13 @@ void PeerManagerImpl::MaybeSendFeefilter(CNode& pto, Peer& peer, std::chrono::mi if (pto.IsBlockOnlyConn()) return; CAmount currentFilter = m_mempool.GetMinFee().GetFeePerK(); - static FeeFilterRounder g_filter_rounder{CFeeRate{DEFAULT_MIN_RELAY_TX_FEE}}; if (m_chainman.IsInitialBlockDownload()) { // Received tx-inv messages are discarded when the active // chainstate is in IBD, so tell the peer to not send them. currentFilter = MAX_MONEY; } else { - static const CAmount MAX_FILTER{g_filter_rounder.round(MAX_MONEY)}; + static const CAmount MAX_FILTER{m_fee_filter_rounder.round(MAX_MONEY)}; if (peer.m_fee_filter_sent == MAX_FILTER) { // Send the current filter if we sent MAX_FILTER previously // and made it out of IBD. @@ -5353,7 +5355,7 @@ void PeerManagerImpl::MaybeSendFeefilter(CNode& pto, Peer& peer, std::chrono::mi } } if (current_time > peer.m_next_send_feefilter) { - CAmount filterToSend = g_filter_rounder.round(currentFilter); + CAmount filterToSend = m_fee_filter_rounder.round(currentFilter); // We always have a fee filter of at least the min relay fee filterToSend = std::max(filterToSend, m_mempool.m_min_relay_feerate.GetFeePerK()); if (filterToSend != peer.m_fee_filter_sent) { |