@@ -490,11 +490,11 @@ class PeerManagerImpl final : public PeerManager
490
490
491
491
/* * Overridden from CValidationInterface. */
492
492
void ActiveTipChange (const CBlockIndex* new_tip, bool ) override
493
- EXCLUSIVE_LOCKS_REQUIRED(!m_recent_confirmed_transactions_mutex, ! m_tx_download_mutex);
493
+ EXCLUSIVE_LOCKS_REQUIRED(!m_tx_download_mutex);
494
494
void BlockConnected (ChainstateRole role, const std::shared_ptr<const CBlock>& pblock, const CBlockIndex* pindexConnected) override
495
- EXCLUSIVE_LOCKS_REQUIRED(!m_recent_confirmed_transactions_mutex, ! m_tx_download_mutex);
495
+ EXCLUSIVE_LOCKS_REQUIRED(!m_tx_download_mutex);
496
496
void BlockDisconnected (const std::shared_ptr<const CBlock> &block, const CBlockIndex* pindex) override
497
- EXCLUSIVE_LOCKS_REQUIRED(!m_recent_confirmed_transactions_mutex, ! m_tx_download_mutex);
497
+ EXCLUSIVE_LOCKS_REQUIRED(!m_tx_download_mutex);
498
498
void UpdatedBlockTip (const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload ) override
499
499
EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex);
500
500
void BlockChecked (const CBlock& block, const BlockValidationState& state) override
@@ -507,9 +507,9 @@ class PeerManagerImpl final : public PeerManager
507
507
void FinalizeNode (const CNode& node) override EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex, !m_headers_presync_mutex, !m_tx_download_mutex);
508
508
bool HasAllDesirableServiceFlags (ServiceFlags services) const override ;
509
509
bool ProcessMessages (CNode* pfrom, std::atomic<bool >& interrupt) override
510
- EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex, !m_recent_confirmed_transactions_mutex, ! m_most_recent_block_mutex, !m_headers_presync_mutex, g_msgproc_mutex, !m_tx_download_mutex);
510
+ EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex, !m_most_recent_block_mutex, !m_headers_presync_mutex, g_msgproc_mutex, !m_tx_download_mutex);
511
511
bool SendMessages (CNode* pto) override
512
- EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex, !m_recent_confirmed_transactions_mutex, ! m_most_recent_block_mutex, g_msgproc_mutex, !m_tx_download_mutex);
512
+ EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex, !m_most_recent_block_mutex, g_msgproc_mutex, !m_tx_download_mutex);
513
513
514
514
/* * Implement PeerManager */
515
515
void StartScheduledTasks (CScheduler& scheduler) override ;
@@ -528,7 +528,7 @@ class PeerManagerImpl final : public PeerManager
528
528
void UnitTestMisbehaving (NodeId peer_id) override EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex) { Misbehaving (*Assert (GetPeerRef (peer_id)), " " ); };
529
529
void ProcessMessage (CNode& pfrom, const std::string& msg_type, DataStream& vRecv,
530
530
const std::chrono::microseconds time_received, const std::atomic<bool >& interruptMsgProc) override
531
- EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex, !m_recent_confirmed_transactions_mutex, ! m_most_recent_block_mutex, !m_headers_presync_mutex, g_msgproc_mutex, !m_tx_download_mutex);
531
+ EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex, !m_most_recent_block_mutex, !m_headers_presync_mutex, g_msgproc_mutex, !m_tx_download_mutex);
532
532
void UpdateLastBlockAnnounceTime (NodeId node, int64_t time_in_seconds) override ;
533
533
ServiceFlags GetDesirableServiceFlags (ServiceFlags services) const override ;
534
534
@@ -863,7 +863,7 @@ class PeerManagerImpl final : public PeerManager
863
863
* - m_recent_confirmed_transactions
864
864
* */
865
865
bool AlreadyHaveTx (const GenTxid& gtxid, bool include_reconsiderable)
866
- EXCLUSIVE_LOCKS_REQUIRED(!m_recent_confirmed_transactions_mutex, m_tx_download_mutex);
866
+ EXCLUSIVE_LOCKS_REQUIRED(m_tx_download_mutex);
867
867
868
868
/* *
869
869
* Filter for transactions that were recently rejected by the mempool.
@@ -938,8 +938,7 @@ class PeerManagerImpl final : public PeerManager
938
938
* transaction per day that would be inadvertently ignored (which is the
939
939
* same probability that we have in the reject filter).
940
940
*/
941
- Mutex m_recent_confirmed_transactions_mutex;
942
- CRollingBloomFilter m_recent_confirmed_transactions GUARDED_BY (m_recent_confirmed_transactions_mutex){48'000 , 0.000'001 };
941
+ CRollingBloomFilter m_recent_confirmed_transactions GUARDED_BY (m_tx_download_mutex){48'000 , 0.000'001 };
943
942
944
943
/* *
945
944
* For sending `inv`s to inbound peers, we use a single (exponentially
@@ -2119,20 +2118,15 @@ void PeerManagerImpl::BlockConnected(
2119
2118
LOCK (m_tx_download_mutex);
2120
2119
m_orphanage.EraseForBlock (*pblock);
2121
2120
2122
- {
2123
- LOCK (m_recent_confirmed_transactions_mutex);
2124
- for (const auto & ptx : pblock->vtx ) {
2125
- m_recent_confirmed_transactions.insert (ptx->GetHash ().ToUint256 ());
2126
- if (ptx->HasWitness ()) {
2127
- m_recent_confirmed_transactions.insert (ptx->GetWitnessHash ().ToUint256 ());
2128
- }
2121
+ for (const auto & ptx : pblock->vtx ) {
2122
+ m_recent_confirmed_transactions.insert (ptx->GetHash ().ToUint256 ());
2123
+ if (ptx->HasWitness ()) {
2124
+ m_recent_confirmed_transactions.insert (ptx->GetWitnessHash ().ToUint256 ());
2129
2125
}
2130
2126
}
2131
- {
2132
- for (const auto & ptx : pblock->vtx ) {
2133
- m_txrequest.ForgetTxHash (ptx->GetHash ());
2134
- m_txrequest.ForgetTxHash (ptx->GetWitnessHash ());
2135
- }
2127
+ for (const auto & ptx : pblock->vtx ) {
2128
+ m_txrequest.ForgetTxHash (ptx->GetHash ());
2129
+ m_txrequest.ForgetTxHash (ptx->GetWitnessHash ());
2136
2130
}
2137
2131
}
2138
2132
@@ -2146,7 +2140,7 @@ void PeerManagerImpl::BlockDisconnected(const std::shared_ptr<const CBlock> &blo
2146
2140
// block's worth of transactions in it, but that should be fine, since
2147
2141
// presumably the most common case of relaying a confirmed transaction
2148
2142
// should be just after a new block containing it is found.
2149
- LOCK (m_recent_confirmed_transactions_mutex );
2143
+ LOCK (m_tx_download_mutex );
2150
2144
m_recent_confirmed_transactions.reset ();
2151
2145
}
2152
2146
@@ -2310,10 +2304,7 @@ bool PeerManagerImpl::AlreadyHaveTx(const GenTxid& gtxid, bool include_reconside
2310
2304
2311
2305
if (include_reconsiderable && m_recent_rejects_reconsiderable.contains (hash)) return true ;
2312
2306
2313
- {
2314
- LOCK (m_recent_confirmed_transactions_mutex);
2315
- if (m_recent_confirmed_transactions.contains (hash)) return true ;
2316
- }
2307
+ if (m_recent_confirmed_transactions.contains (hash)) return true ;
2317
2308
2318
2309
return m_recent_rejects.contains (hash) || m_mempool.exists (gtxid);
2319
2310
}
0 commit comments