diff options
author | fanquake <fanquake@gmail.com> | 2020-05-28 15:42:06 +0800 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2020-05-28 21:43:36 +0800 |
commit | 789e9dd3aa727176797529c35b2848f994630a82 (patch) | |
tree | b8b9c24c53ad34995b1129eaf18c4e1630cc07e5 /src | |
parent | 47be28c8bc475eafeebd4fc58ea92f0d3df0d8c6 (diff) | |
download | bitcoin-789e9dd3aa727176797529c35b2848f994630a82.tar.xz |
validation: use std::chrono in IsCurrentForFeeEstimation()
Diffstat (limited to 'src')
-rw-r--r-- | src/validation.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/validation.cpp b/src/validation.cpp index 6678e415c8..035000134c 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -75,8 +75,8 @@ static const unsigned int UNDOFILE_CHUNK_SIZE = 0x100000; // 1 MiB static constexpr std::chrono::hours DATABASE_WRITE_INTERVAL{1}; /** Time to wait between flushing chainstate to disk. */ static constexpr std::chrono::hours DATABASE_FLUSH_INTERVAL{24}; -/** Maximum age of our tip in seconds for us to be considered current for fee estimation */ -static const int64_t MAX_FEE_ESTIMATION_TIP_AGE = 3 * 60 * 60; +/** Maximum age of our tip for us to be considered current for fee estimation */ +static constexpr std::chrono::hours MAX_FEE_ESTIMATION_TIP_AGE{3}; bool CBlockIndexWorkComparator::operator()(const CBlockIndex *pa, const CBlockIndex *pb) const { // First sort by most total work, ... @@ -347,7 +347,7 @@ static bool IsCurrentForFeeEstimation() EXCLUSIVE_LOCKS_REQUIRED(cs_main) AssertLockHeld(cs_main); if (::ChainstateActive().IsInitialBlockDownload()) return false; - if (::ChainActive().Tip()->GetBlockTime() < (GetTime() - MAX_FEE_ESTIMATION_TIP_AGE)) + if (::ChainActive().Tip()->GetBlockTime() < count_seconds(GetTime<std::chrono::seconds>() - MAX_FEE_ESTIMATION_TIP_AGE)) return false; if (::ChainActive().Height() < pindexBestHeader->nHeight - 1) return false; |