Skip to content

Commit d0af423

Browse files
committed
[prep/refactor] move DEFAULT_MAX_ORPHAN_TRANSACTIONS to txorphanage.h
This is move only.
1 parent 5136522 commit d0af423

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/net_processing.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ class Warnings;
3636

3737
/** Whether transaction reconciliation protocol should be enabled by default. */
3838
static constexpr bool DEFAULT_TXRECONCILIATION_ENABLE{false};
39-
/** Default maximum number of orphan transactions kept in memory */
40-
static const uint32_t DEFAULT_MAX_ORPHAN_TRANSACTIONS{100};
4139
/** Default number of non-mempool transactions to keep around for block reconstruction. Includes
4240
orphan, replaced, and rejected transactions. */
4341
static const uint32_t DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN{100};
@@ -79,7 +77,7 @@ class PeerManager : public CValidationInterface, public NetEventsInterface
7977
//! Whether transaction reconciliation protocol is enabled
8078
bool reconcile_txs{DEFAULT_TXRECONCILIATION_ENABLE};
8179
//! Maximum number of orphan transactions kept in memory
82-
uint32_t max_orphan_txs{DEFAULT_MAX_ORPHAN_TRANSACTIONS};
80+
uint32_t max_orphan_txs{node::DEFAULT_MAX_ORPHAN_TRANSACTIONS};
8381
//! Number of non-mempool transactions to keep around for block reconstruction. Includes
8482
//! orphan, replaced, and rejected transactions.
8583
uint32_t max_extra_txs{DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN};

src/node/txorphanage.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ namespace node{
2020
static constexpr auto ORPHAN_TX_EXPIRE_TIME{20min};
2121
/** Minimum time between orphan transactions expire time checks */
2222
static constexpr auto ORPHAN_TX_EXPIRE_INTERVAL{5min};
23+
/** Default maximum number of orphan transactions kept in memory */
24+
static const uint32_t DEFAULT_MAX_ORPHAN_TRANSACTIONS{100};
2325

2426
/** A class to track orphan transactions (failed on TX_MISSING_INPUTS)
2527
* Since we cannot distinguish orphans from bad transactions with

src/test/fuzz/txorphan.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ FUZZ_TARGET(txorphan, .init = initialize_orphanage)
5050

5151
std::vector<CTransactionRef> tx_history;
5252

53-
LIMITED_WHILE(outpoints.size() < 200'000 && fuzzed_data_provider.ConsumeBool(), 10 * DEFAULT_MAX_ORPHAN_TRANSACTIONS)
53+
LIMITED_WHILE(outpoints.size() < 200'000 && fuzzed_data_provider.ConsumeBool(), 10 * node::DEFAULT_MAX_ORPHAN_TRANSACTIONS)
5454
{
5555
// construct transaction
5656
const CTransactionRef tx = [&] {
@@ -98,7 +98,7 @@ FUZZ_TARGET(txorphan, .init = initialize_orphanage)
9898
}
9999

100100
// trigger orphanage functions
101-
LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 10 * DEFAULT_MAX_ORPHAN_TRANSACTIONS)
101+
LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 10 * node::DEFAULT_MAX_ORPHAN_TRANSACTIONS)
102102
{
103103
NodeId peer_id = fuzzed_data_provider.ConsumeIntegral<NodeId>();
104104
const auto total_bytes_start{orphanage.TotalOrphanUsage()};

src/test/txdownload_tests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ BOOST_FIXTURE_TEST_CASE(tx_rejection_types, TestChain100Setup)
114114
{
115115
CTxMemPool& pool = *Assert(m_node.mempool);
116116
FastRandomContext det_rand{true};
117-
node::TxDownloadOptions DEFAULT_OPTS{pool, det_rand, DEFAULT_MAX_ORPHAN_TRANSACTIONS, true};
117+
node::TxDownloadOptions DEFAULT_OPTS{pool, det_rand, node::DEFAULT_MAX_ORPHAN_TRANSACTIONS, true};
118118

119119
// A new TxDownloadManagerImpl is created for each tx so we can just reuse the same one.
120120
TxValidationState state;
@@ -172,7 +172,7 @@ BOOST_FIXTURE_TEST_CASE(handle_missing_inputs, TestChain100Setup)
172172
{
173173
CTxMemPool& pool = *Assert(m_node.mempool);
174174
FastRandomContext det_rand{true};
175-
node::TxDownloadOptions DEFAULT_OPTS{pool, det_rand, DEFAULT_MAX_ORPHAN_TRANSACTIONS, true};
175+
node::TxDownloadOptions DEFAULT_OPTS{pool, det_rand, node::DEFAULT_MAX_ORPHAN_TRANSACTIONS, true};
176176
NodeId nodeid{1};
177177
node::TxDownloadConnectionInfo DEFAULT_CONN{/*m_preferred=*/false, /*m_relay_permissions=*/false, /*m_wtxid_relay=*/true};
178178

0 commit comments

Comments
 (0)