diff options
author | MarcoFalke <falke.marco@gmail.com> | 2020-04-29 21:29:40 +0200 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-01-07 15:25:47 +0100 |
commit | fad1f0fd33e5e7a65b702237c7ca8e1b694852d2 (patch) | |
tree | 56e4dd78c242cc0d9ab2e512c6c98fb8e1b4af45 | |
parent | 42675e783337bf56dfc51df6c14931df5e72f185 (diff) | |
download | bitcoin-fad1f0fd33e5e7a65b702237c7ca8e1b694852d2.tar.xz |
net: Remove unused cs_feeFilter
-rw-r--r-- | src/net.cpp | 1 | ||||
-rw-r--r-- | src/net.h | 5 | ||||
-rw-r--r-- | src/net_processing.cpp | 13 |
3 files changed, 4 insertions, 15 deletions
diff --git a/src/net.cpp b/src/net.cpp index ad4af4abb2..14c75b8d06 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -601,7 +601,6 @@ void CNode::copyStats(CNodeStats &stats, const std::vector<bool> &m_asmap) } X(m_permissionFlags); if (m_tx_relay != nullptr) { - LOCK(m_tx_relay->cs_feeFilter); stats.minFeeFilter = m_tx_relay->minFeeFilter; } else { stats.minFeeFilter = 0; @@ -573,9 +573,8 @@ public: std::atomic<std::chrono::seconds> m_last_mempool_req{0s}; std::chrono::microseconds nNextInvSend{0}; - RecursiveMutex cs_feeFilter; - // Minimum fee rate with which to filter inv's to this node - CAmount minFeeFilter GUARDED_BY(cs_feeFilter){0}; + /** Minimum fee rate with which to filter inv's to this node */ + std::atomic<CAmount> minFeeFilter{0}; CAmount lastSentFeeFilter{0}; int64_t nextSendTimeFeeFilter{0}; }; diff --git a/src/net_processing.cpp b/src/net_processing.cpp index dc9b051ddd..8f1cb952f2 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -3712,7 +3712,6 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat vRecv >> newFeeFilter; if (MoneyRange(newFeeFilter)) { if (pfrom.m_tx_relay != nullptr) { - LOCK(pfrom.m_tx_relay->cs_feeFilter); pfrom.m_tx_relay->minFeeFilter = newFeeFilter; } LogPrint(BCLog::NET, "received: feefilter of %s from peer=%d\n", CFeeRate(newFeeFilter).ToString(), pfrom.GetId()); @@ -4388,11 +4387,7 @@ bool PeerManager::SendMessages(CNode* pto) if (fSendTrickle && pto->m_tx_relay->fSendMempool) { auto vtxinfo = m_mempool.infoAll(); pto->m_tx_relay->fSendMempool = false; - CFeeRate filterrate; - { - LOCK(pto->m_tx_relay->cs_feeFilter); - filterrate = CFeeRate(pto->m_tx_relay->minFeeFilter); - } + const CFeeRate filterrate{pto->m_tx_relay->minFeeFilter.load()}; LOCK(pto->m_tx_relay->cs_filter); @@ -4426,11 +4421,7 @@ bool PeerManager::SendMessages(CNode* pto) for (std::set<uint256>::iterator it = pto->m_tx_relay->setInventoryTxToSend.begin(); it != pto->m_tx_relay->setInventoryTxToSend.end(); it++) { vInvTx.push_back(it); } - CFeeRate filterrate; - { - LOCK(pto->m_tx_relay->cs_feeFilter); - filterrate = CFeeRate(pto->m_tx_relay->minFeeFilter); - } + const CFeeRate filterrate{pto->m_tx_relay->minFeeFilter.load()}; // Topologically and fee-rate sort the inventory we send for privacy and priority reasons. // A heap is used so that not all items need sorting if only a few are being sent. CompareInvMempoolOrder compareInvMempoolOrder(&m_mempool, state.m_wtxid_relay); |