diff options
author | ismaelsadeeq <ask4ismailsadiq@gmail.com> | 2023-06-08 13:14:11 +0100 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2023-09-26 16:26:55 +0100 |
commit | 77979e0172d0bc86bfbc60f6a652e26c77722e29 (patch) | |
tree | 3abf15ae12cb092f518925c65da08aae6be96d09 /src/policy/fees.cpp | |
parent | 67b6d99aead0d1b2030bc3e88256d279477894b5 (diff) |
tx fees, policy: periodically flush fee estimates to fee_estimates.dat
This reduces chances of having old estimates in fee_estimates.dat.
Github-Pull: #27622
Rebased-From: 5b886f2b436eaa8c2b7de58dc4644dc6223040da
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 2b940be07e..6b8d52b2c5 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())); } } |