Skip to content

Commit eeeafb3

Browse files
committed
net_processing: move AddToCompactExtraTransactions into PeerManagerImpl
Allows making vExtraTxnForCompact and vExtraTxnForCompactIt member vars instead of globals.
1 parent f8c0688 commit eeeafb3

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/net_processing.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -459,19 +459,21 @@ class PeerManagerImpl final : public PeerManager
459459

460460
/** Storage for orphan information */
461461
TxOrphanage m_orphanage;
462-
};
463-
} // namespace
464462

465-
namespace {
466-
/** Number of preferable block download peers. */
467-
int nPreferredDownload GUARDED_BY(cs_main) = 0;
463+
void AddToCompactExtraTransactions(const CTransactionRef& tx) EXCLUSIVE_LOCKS_REQUIRED(g_cs_orphans);
468464

469465
/** Orphan/conflicted/etc transactions that are kept for compact block reconstruction.
470466
* The last -blockreconstructionextratxn/DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN of
471467
* these are kept in a ring buffer */
472-
static std::vector<std::pair<uint256, CTransactionRef>> vExtraTxnForCompact GUARDED_BY(g_cs_orphans);
468+
std::vector<std::pair<uint256, CTransactionRef>> vExtraTxnForCompact GUARDED_BY(g_cs_orphans);
473469
/** Offset into vExtraTxnForCompact to insert the next tx */
474-
static size_t vExtraTxnForCompactIt GUARDED_BY(g_cs_orphans) = 0;
470+
size_t vExtraTxnForCompactIt GUARDED_BY(g_cs_orphans) = 0;
471+
};
472+
} // namespace
473+
474+
namespace {
475+
/** Number of preferable block download peers. */
476+
int nPreferredDownload GUARDED_BY(cs_main) = 0;
475477
} // namespace
476478

477479
namespace {
@@ -1081,7 +1083,7 @@ bool PeerManagerImpl::GetNodeStateStats(NodeId nodeid, CNodeStateStats &stats)
10811083
return true;
10821084
}
10831085

1084-
static void AddToCompactExtraTransactions(const CTransactionRef& tx) EXCLUSIVE_LOCKS_REQUIRED(g_cs_orphans)
1086+
void PeerManagerImpl::AddToCompactExtraTransactions(const CTransactionRef& tx)
10851087
{
10861088
size_t max_extra_txn = gArgs.GetArg("-blockreconstructionextratxn", DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN);
10871089
if (max_extra_txn <= 0)

0 commit comments

Comments
 (0)