Skip to content

Commit 1ecc773

Browse files
committed
scripted-diff: Rename DEFAULT_MEMPOOL_EXPIRY to indicate time unit
Better to be explicit when it comes to time to avoid unintentional bugs. -BEGIN VERIFY SCRIPT- find_regex="DEFAULT_MEMPOOL_EXPIRY" \ && git grep -l -E "$find_regex" \ | xargs sed -i -E "s@$find_regex@\0_HOURS@g" -END VERIFY SCRIPT-
1 parent aa9141c commit 1ecc773

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/init.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ void SetupServerArgs(ArgsManager& argsman)
417417
argsman.AddArg("-loadblock=<file>", "Imports blocks from external file on startup", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
418418
argsman.AddArg("-maxmempool=<n>", strprintf("Keep the transaction memory pool below <n> megabytes (default: %u)", DEFAULT_MAX_MEMPOOL_SIZE_MB), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
419419
argsman.AddArg("-maxorphantx=<n>", strprintf("Keep at most <n> unconnectable transactions in memory (default: %u)", DEFAULT_MAX_ORPHAN_TRANSACTIONS), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
420-
argsman.AddArg("-mempoolexpiry=<n>", strprintf("Do not keep transactions in the mempool longer than <n> hours (default: %u)", DEFAULT_MEMPOOL_EXPIRY), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
420+
argsman.AddArg("-mempoolexpiry=<n>", strprintf("Do not keep transactions in the mempool longer than <n> hours (default: %u)", DEFAULT_MEMPOOL_EXPIRY_HOURS), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
421421
argsman.AddArg("-minimumchainwork=<hex>", strprintf("Minimum work assumed to exist on a valid chain in hex (default: %s, testnet: %s, signet: %s)", defaultChainParams->GetConsensus().nMinimumChainWork.GetHex(), testnetChainParams->GetConsensus().nMinimumChainWork.GetHex(), signetChainParams->GetConsensus().nMinimumChainWork.GetHex()), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::OPTIONS);
422422
argsman.AddArg("-par=<n>", strprintf("Set the number of script verification threads (%u to %d, 0 = auto, <0 = leave that many cores free, default: %d)",
423423
-GetNumCores(), MAX_SCRIPTCHECK_THREADS, DEFAULT_SCRIPTCHECK_THREADS), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);

src/kernel/mempool_options.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class CBlockPolicyEstimator;
1212
/** Default for -maxmempool, maximum megabytes of mempool memory usage */
1313
static constexpr unsigned int DEFAULT_MAX_MEMPOOL_SIZE_MB{300};
1414
/** Default for -mempoolexpiry, expiration time for mempool transactions in hours */
15-
static constexpr unsigned int DEFAULT_MEMPOOL_EXPIRY{336};
15+
static constexpr unsigned int DEFAULT_MEMPOOL_EXPIRY_HOURS{336};
1616

1717
namespace kernel {
1818
/**
@@ -28,7 +28,7 @@ struct MemPoolOptions {
2828
/* The ratio used to determine how often sanity checks will run. */
2929
int check_ratio{0};
3030
int64_t max_size_bytes{DEFAULT_MAX_MEMPOOL_SIZE_MB * 1'000'000};
31-
std::chrono::seconds expiry{std::chrono::hours{DEFAULT_MEMPOOL_EXPIRY}};
31+
std::chrono::seconds expiry{std::chrono::hours{DEFAULT_MEMPOOL_EXPIRY_HOURS}};
3232
};
3333
} // namespace kernel
3434

test/functional/mempool_expiry.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"""Tests that a mempool transaction expires after a given timeout and that its
66
children are removed as well.
77
8-
Both the default expiry timeout defined by DEFAULT_MEMPOOL_EXPIRY and a user
8+
Both the default expiry timeout defined by DEFAULT_MEMPOOL_EXPIRY_HOURS and a user
99
definable expiry timeout via the '-mempoolexpiry=<n>' command line argument
1010
(<n> is the timeout in hours) are tested.
1111
"""
@@ -20,7 +20,7 @@
2020
)
2121
from test_framework.wallet import MiniWallet
2222

23-
DEFAULT_MEMPOOL_EXPIRY = 336 # hours
23+
DEFAULT_MEMPOOL_EXPIRY_HOURS = 336 # hours
2424
CUSTOM_MEMPOOL_EXPIRY = 10 # hours
2525

2626

@@ -98,8 +98,8 @@ def test_transaction_expiry(self, timeout):
9898

9999
def run_test(self):
100100
self.log.info('Test default mempool expiry timeout of %d hours.' %
101-
DEFAULT_MEMPOOL_EXPIRY)
102-
self.test_transaction_expiry(DEFAULT_MEMPOOL_EXPIRY)
101+
DEFAULT_MEMPOOL_EXPIRY_HOURS)
102+
self.test_transaction_expiry(DEFAULT_MEMPOOL_EXPIRY_HOURS)
103103

104104
self.log.info('Test custom mempool expiry timeout of %d hours.' %
105105
CUSTOM_MEMPOOL_EXPIRY)

0 commit comments

Comments
 (0)