Skip to content

Commit 789e9dd

Browse files
committed
validation: use std::chrono in IsCurrentForFeeEstimation()
1 parent 47be28c commit 789e9dd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/validation.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ static const unsigned int UNDOFILE_CHUNK_SIZE = 0x100000; // 1 MiB
7575
static constexpr std::chrono::hours DATABASE_WRITE_INTERVAL{1};
7676
/** Time to wait between flushing chainstate to disk. */
7777
static constexpr std::chrono::hours DATABASE_FLUSH_INTERVAL{24};
78-
/** Maximum age of our tip in seconds for us to be considered current for fee estimation */
79-
static const int64_t MAX_FEE_ESTIMATION_TIP_AGE = 3 * 60 * 60;
78+
/** Maximum age of our tip for us to be considered current for fee estimation */
79+
static constexpr std::chrono::hours MAX_FEE_ESTIMATION_TIP_AGE{3};
8080

8181
bool CBlockIndexWorkComparator::operator()(const CBlockIndex *pa, const CBlockIndex *pb) const {
8282
// First sort by most total work, ...
@@ -347,7 +347,7 @@ static bool IsCurrentForFeeEstimation() EXCLUSIVE_LOCKS_REQUIRED(cs_main)
347347
AssertLockHeld(cs_main);
348348
if (::ChainstateActive().IsInitialBlockDownload())
349349
return false;
350-
if (::ChainActive().Tip()->GetBlockTime() < (GetTime() - MAX_FEE_ESTIMATION_TIP_AGE))
350+
if (::ChainActive().Tip()->GetBlockTime() < count_seconds(GetTime<std::chrono::seconds>() - MAX_FEE_ESTIMATION_TIP_AGE))
351351
return false;
352352
if (::ChainActive().Height() < pindexBestHeader->nHeight - 1)
353353
return false;

0 commit comments

Comments
 (0)