diff options
author | Anthony Towns <aj@erisian.com.au> | 2021-01-31 23:50:53 +1000 |
---|---|---|
committer | Anthony Towns <aj@erisian.com.au> | 2021-02-27 01:08:09 +1000 |
commit | eeeafb324ef6057f40b5c5fdd8464110e809b0f7 (patch) | |
tree | ece3731edd6340d867b4ed5267ce9da7d7a3eb55 | |
parent | f8c0688b9490c8d4902530ba3c3b6fbd8b48e0de (diff) |
net_processing: move AddToCompactExtraTransactions into PeerManagerImpl
Allows making vExtraTxnForCompact and vExtraTxnForCompactIt member vars
instead of globals.
-rw-r--r-- | src/net_processing.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 98d9709eb2..af61e7064e 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -459,19 +459,21 @@ private: /** Storage for orphan information */ TxOrphanage m_orphanage; -}; -} // namespace -namespace { - /** Number of preferable block download peers. */ - int nPreferredDownload GUARDED_BY(cs_main) = 0; + void AddToCompactExtraTransactions(const CTransactionRef& tx) EXCLUSIVE_LOCKS_REQUIRED(g_cs_orphans); /** Orphan/conflicted/etc transactions that are kept for compact block reconstruction. * The last -blockreconstructionextratxn/DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN of * these are kept in a ring buffer */ - static std::vector<std::pair<uint256, CTransactionRef>> vExtraTxnForCompact GUARDED_BY(g_cs_orphans); + std::vector<std::pair<uint256, CTransactionRef>> vExtraTxnForCompact GUARDED_BY(g_cs_orphans); /** Offset into vExtraTxnForCompact to insert the next tx */ - static size_t vExtraTxnForCompactIt GUARDED_BY(g_cs_orphans) = 0; + size_t vExtraTxnForCompactIt GUARDED_BY(g_cs_orphans) = 0; +}; +} // namespace + +namespace { + /** Number of preferable block download peers. */ + int nPreferredDownload GUARDED_BY(cs_main) = 0; } // namespace namespace { @@ -1081,7 +1083,7 @@ bool PeerManagerImpl::GetNodeStateStats(NodeId nodeid, CNodeStateStats &stats) return true; } -static void AddToCompactExtraTransactions(const CTransactionRef& tx) EXCLUSIVE_LOCKS_REQUIRED(g_cs_orphans) +void PeerManagerImpl::AddToCompactExtraTransactions(const CTransactionRef& tx) { size_t max_extra_txn = gArgs.GetArg("-blockreconstructionextratxn", DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN); if (max_extra_txn <= 0) |