aboutsummaryrefslogtreecommitdiff
path: root/src/policy/fees.cpp
diff options
context:
space:
mode:
authorismaelsadeeq <ask4ismailsadiq@gmail.com>2023-06-08 13:14:11 +0100
committerismaelsadeeq <ask4ismailsadiq@gmail.com>2023-06-14 21:42:41 +0100
commit5b886f2b436eaa8c2b7de58dc4644dc6223040da (patch)
treed90cd994354e574e296cd110a066fce18728a4cb /src/policy/fees.cpp
parent681ecac5c2d462920cd32636eec15599a9bcf424 (diff)
downloadbitcoin-5b886f2b436eaa8c2b7de58dc4644dc6223040da.tar.xz
tx fees, policy: periodically flush fee estimates to fee_estimates.dat
This reduces chances of having old estimates in fee_estimates.dat.
Diffstat (limited to 'src/policy/fees.cpp')
-rw-r--r--src/policy/fees.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/policy/fees.cpp b/src/policy/fees.cpp
index ae226f7011..7bbc9b5e89 100644
--- a/src/policy/fees.cpp
+++ b/src/policy/fees.cpp
@@ -903,10 +903,16 @@ CFeeRate CBlockPolicyEstimator::estimateSmartFee(int confTarget, FeeCalculation
void CBlockPolicyEstimator::Flush() {
FlushUnconfirmed();
+ FlushFeeEstimates();
+}
+void CBlockPolicyEstimator::FlushFeeEstimates()
+{
AutoFile est_file{fsbridge::fopen(m_estimation_filepath, "wb")};
if (est_file.IsNull() || !Write(est_file)) {
LogPrintf("Failed to write fee estimates to %s. Continue anyway.\n", fs::PathToString(m_estimation_filepath));
+ } else {
+ LogPrintf("Flushed fee estimates to %s.\n", fs::PathToString(m_estimation_filepath.filename()));
}
}