Skip to content

Commit ae1e8e3

Browse files
committed
mempool: Use NodeClock+friends for LoadMempool
1 parent f9e8e57 commit ae1e8e3

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/validation.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4644,7 +4644,6 @@ static const uint64_t MEMPOOL_DUMP_VERSION = 1;
46444644

46454645
bool LoadMempool(CTxMemPool& pool, CChainState& active_chainstate, FopenFn mockable_fopen_function)
46464646
{
4647-
int64_t nExpiryTimeout = std::chrono::seconds{pool.m_expiry}.count();
46484647
FILE* filestr{mockable_fopen_function(gArgs.GetDataDirNet() / "mempool.dat", "rb")};
46494648
CAutoFile file(filestr, SER_DISK, CLIENT_VERSION);
46504649
if (file.IsNull()) {
@@ -4657,7 +4656,7 @@ bool LoadMempool(CTxMemPool& pool, CChainState& active_chainstate, FopenFn mocka
46574656
int64_t failed = 0;
46584657
int64_t already_there = 0;
46594658
int64_t unbroadcast = 0;
4660-
int64_t nNow = GetTime();
4659+
auto now = NodeClock::now();
46614660

46624661
try {
46634662
uint64_t version;
@@ -4680,7 +4679,7 @@ bool LoadMempool(CTxMemPool& pool, CChainState& active_chainstate, FopenFn mocka
46804679
if (amountdelta) {
46814680
pool.PrioritiseTransaction(tx->GetHash(), amountdelta);
46824681
}
4683-
if (nTime > nNow - nExpiryTimeout) {
4682+
if (nTime > TicksSinceEpoch<std::chrono::seconds>(now - pool.m_expiry)) {
46844683
LOCK(cs_main);
46854684
const auto& accepted = AcceptToMemoryPool(active_chainstate, tx, nTime, /*bypass_limits=*/false, /*test_accept=*/false);
46864685
if (accepted.m_result_type == MempoolAcceptResult::ResultType::VALID) {

0 commit comments

Comments
 (0)