aboutsummaryrefslogtreecommitdiff
path: root/src/validation.cpp
diff options
context:
space:
mode:
authorCarl Dong <contact@carldong.me>2022-06-29 13:28:45 -0400
committerCarl Dong <contact@carldong.me>2022-07-15 11:35:13 -0400
commitae1e8e37567fa603a5977d7d05105c682dd3f7db (patch)
tree7a446c905bb062426e68b4568c159a894a52cfb0 /src/validation.cpp
parentf9e8e5719f28d84f68f7d75e26c8e7fccac8e7d3 (diff)
downloadbitcoin-ae1e8e37567fa603a5977d7d05105c682dd3f7db.tar.xz
mempool: Use NodeClock+friends for LoadMempool
Diffstat (limited to 'src/validation.cpp')
-rw-r--r--src/validation.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/validation.cpp b/src/validation.cpp
index 5c7bfc510c..1d24f14dd8 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -4644,7 +4644,6 @@ static const uint64_t MEMPOOL_DUMP_VERSION = 1;
bool LoadMempool(CTxMemPool& pool, CChainState& active_chainstate, FopenFn mockable_fopen_function)
{
- int64_t nExpiryTimeout = std::chrono::seconds{pool.m_expiry}.count();
FILE* filestr{mockable_fopen_function(gArgs.GetDataDirNet() / "mempool.dat", "rb")};
CAutoFile file(filestr, SER_DISK, CLIENT_VERSION);
if (file.IsNull()) {
@@ -4657,7 +4656,7 @@ bool LoadMempool(CTxMemPool& pool, CChainState& active_chainstate, FopenFn mocka
int64_t failed = 0;
int64_t already_there = 0;
int64_t unbroadcast = 0;
- int64_t nNow = GetTime();
+ auto now = NodeClock::now();
try {
uint64_t version;
@@ -4680,7 +4679,7 @@ bool LoadMempool(CTxMemPool& pool, CChainState& active_chainstate, FopenFn mocka
if (amountdelta) {
pool.PrioritiseTransaction(tx->GetHash(), amountdelta);
}
- if (nTime > nNow - nExpiryTimeout) {
+ if (nTime > TicksSinceEpoch<std::chrono::seconds>(now - pool.m_expiry)) {
LOCK(cs_main);
const auto& accepted = AcceptToMemoryPool(active_chainstate, tx, nTime, /*bypass_limits=*/false, /*test_accept=*/false);
if (accepted.m_result_type == MempoolAcceptResult::ResultType::VALID) {