aboutsummaryrefslogtreecommitdiff
path: root/src/policy/fees.cpp
diff options
context:
space:
mode:
authorismaelsadeeq <ask4ismailsadiq@gmail.com>2023-06-14 22:39:26 +0100
committerismaelsadeeq <ask4ismailsadiq@gmail.com>2023-06-14 22:39:26 +0100
commitcf219f29f3c5b41070eaab9a549a476f01990f3a (patch)
treeac5367737ca406fcb404261118542cd5565a315a /src/policy/fees.cpp
parent3eb241a141defa564c94cb95c5bbaf4c5bd9682e (diff)
downloadbitcoin-cf219f29f3c5b41070eaab9a549a476f01990f3a.tar.xz
tx fees, policy: read stale fee estimates with a regtest-only option
If -acceptstalefeeestimates option is passed stale fee estimates can now be read when operating in regtest environments. Additionally, this commit updates all declarations of the CBlockPolicyEstimator class to include a the second constructor variable.
Diffstat (limited to 'src/policy/fees.cpp')
-rw-r--r--src/policy/fees.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/policy/fees.cpp b/src/policy/fees.cpp
index a8ca8545d3..c8f2df781b 100644
--- a/src/policy/fees.cpp
+++ b/src/policy/fees.cpp
@@ -528,7 +528,7 @@ bool CBlockPolicyEstimator::_removeTx(const uint256& hash, bool inBlock)
}
}
-CBlockPolicyEstimator::CBlockPolicyEstimator(const fs::path& estimation_filepath)
+CBlockPolicyEstimator::CBlockPolicyEstimator(const fs::path& estimation_filepath, const bool read_stale_estimates)
: m_estimation_filepath{estimation_filepath}
{
static_assert(MIN_BUCKET_FEERATE > 0, "Min feerate must be nonzero");
@@ -556,7 +556,7 @@ CBlockPolicyEstimator::CBlockPolicyEstimator(const fs::path& estimation_filepath
std::chrono::hours file_age = GetFeeEstimatorFileAge();
// fee estimate file must not be too old to avoid wrong fee estimates.
- if (file_age > MAX_FILE_AGE) {
+ if (file_age > MAX_FILE_AGE && !read_stale_estimates) {
LogPrintf("Fee estimation file %s too old (age=%lld > %lld hours) and will not be used to avoid serving stale estimates.\n", fs::PathToString(m_estimation_filepath), Ticks<std::chrono::hours>(file_age), Ticks<std::chrono::hours>(MAX_FILE_AGE));
return;
}