diff options
author | ismaelsadeeq <ask4ismailsadiq@gmail.com> | 2023-06-08 13:14:11 +0100 |
---|---|---|
committer | ismaelsadeeq <ask4ismailsadiq@gmail.com> | 2023-06-14 21:42:41 +0100 |
commit | 5b886f2b436eaa8c2b7de58dc4644dc6223040da (patch) | |
tree | d90cd994354e574e296cd110a066fce18728a4cb /src/policy/fees.cpp | |
parent | 681ecac5c2d462920cd32636eec15599a9bcf424 (diff) | |
download | bitcoin-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.cpp | 6 |
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())); } } |