mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-08-24 18:51:30 +02:00
[prep/refactor] move DEFAULT_MAX_ORPHAN_TRANSACTIONS to txorphanage.h
This is move only.
This commit is contained in:
@@ -36,8 +36,6 @@ class Warnings;
|
||||
|
||||
/** Whether transaction reconciliation protocol should be enabled by default. */
|
||||
static constexpr bool DEFAULT_TXRECONCILIATION_ENABLE{false};
|
||||
/** Default maximum number of orphan transactions kept in memory */
|
||||
static const uint32_t DEFAULT_MAX_ORPHAN_TRANSACTIONS{100};
|
||||
/** Default number of non-mempool transactions to keep around for block reconstruction. Includes
|
||||
orphan, replaced, and rejected transactions. */
|
||||
static const uint32_t DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN{100};
|
||||
@@ -79,7 +77,7 @@ public:
|
||||
//! Whether transaction reconciliation protocol is enabled
|
||||
bool reconcile_txs{DEFAULT_TXRECONCILIATION_ENABLE};
|
||||
//! Maximum number of orphan transactions kept in memory
|
||||
uint32_t max_orphan_txs{DEFAULT_MAX_ORPHAN_TRANSACTIONS};
|
||||
uint32_t max_orphan_txs{node::DEFAULT_MAX_ORPHAN_TRANSACTIONS};
|
||||
//! Number of non-mempool transactions to keep around for block reconstruction. Includes
|
||||
//! orphan, replaced, and rejected transactions.
|
||||
uint32_t max_extra_txs{DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN};
|
||||
|
@@ -20,6 +20,8 @@ namespace node{
|
||||
static constexpr auto ORPHAN_TX_EXPIRE_TIME{20min};
|
||||
/** Minimum time between orphan transactions expire time checks */
|
||||
static constexpr auto ORPHAN_TX_EXPIRE_INTERVAL{5min};
|
||||
/** Default maximum number of orphan transactions kept in memory */
|
||||
static const uint32_t DEFAULT_MAX_ORPHAN_TRANSACTIONS{100};
|
||||
|
||||
/** A class to track orphan transactions (failed on TX_MISSING_INPUTS)
|
||||
* Since we cannot distinguish orphans from bad transactions with
|
||||
|
@@ -50,7 +50,7 @@ FUZZ_TARGET(txorphan, .init = initialize_orphanage)
|
||||
|
||||
std::vector<CTransactionRef> tx_history;
|
||||
|
||||
LIMITED_WHILE(outpoints.size() < 200'000 && fuzzed_data_provider.ConsumeBool(), 10 * DEFAULT_MAX_ORPHAN_TRANSACTIONS)
|
||||
LIMITED_WHILE(outpoints.size() < 200'000 && fuzzed_data_provider.ConsumeBool(), 10 * node::DEFAULT_MAX_ORPHAN_TRANSACTIONS)
|
||||
{
|
||||
// construct transaction
|
||||
const CTransactionRef tx = [&] {
|
||||
@@ -98,7 +98,7 @@ FUZZ_TARGET(txorphan, .init = initialize_orphanage)
|
||||
}
|
||||
|
||||
// trigger orphanage functions
|
||||
LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 10 * DEFAULT_MAX_ORPHAN_TRANSACTIONS)
|
||||
LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 10 * node::DEFAULT_MAX_ORPHAN_TRANSACTIONS)
|
||||
{
|
||||
NodeId peer_id = fuzzed_data_provider.ConsumeIntegral<NodeId>();
|
||||
const auto total_bytes_start{orphanage.TotalOrphanUsage()};
|
||||
|
@@ -114,7 +114,7 @@ BOOST_FIXTURE_TEST_CASE(tx_rejection_types, TestChain100Setup)
|
||||
{
|
||||
CTxMemPool& pool = *Assert(m_node.mempool);
|
||||
FastRandomContext det_rand{true};
|
||||
node::TxDownloadOptions DEFAULT_OPTS{pool, det_rand, DEFAULT_MAX_ORPHAN_TRANSACTIONS, true};
|
||||
node::TxDownloadOptions DEFAULT_OPTS{pool, det_rand, node::DEFAULT_MAX_ORPHAN_TRANSACTIONS, true};
|
||||
|
||||
// A new TxDownloadManagerImpl is created for each tx so we can just reuse the same one.
|
||||
TxValidationState state;
|
||||
@@ -172,7 +172,7 @@ BOOST_FIXTURE_TEST_CASE(handle_missing_inputs, TestChain100Setup)
|
||||
{
|
||||
CTxMemPool& pool = *Assert(m_node.mempool);
|
||||
FastRandomContext det_rand{true};
|
||||
node::TxDownloadOptions DEFAULT_OPTS{pool, det_rand, DEFAULT_MAX_ORPHAN_TRANSACTIONS, true};
|
||||
node::TxDownloadOptions DEFAULT_OPTS{pool, det_rand, node::DEFAULT_MAX_ORPHAN_TRANSACTIONS, true};
|
||||
NodeId nodeid{1};
|
||||
node::TxDownloadConnectionInfo DEFAULT_CONN{/*m_preferred=*/false, /*m_relay_permissions=*/false, /*m_wtxid_relay=*/true};
|
||||
|
||||
|
Reference in New Issue
Block a user