aboutsummaryrefslogtreecommitdiff
path: root/src/policy/fees.h
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.h
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.h')
-rw-r--r--src/policy/fees.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/policy/fees.h b/src/policy/fees.h
index 775a72a764..a6c45839b9 100644
--- a/src/policy/fees.h
+++ b/src/policy/fees.h
@@ -14,12 +14,17 @@
#include <util/fs.h>
#include <array>
+#include <chrono>
#include <map>
#include <memory>
#include <set>
#include <string>
#include <vector>
+
+// How often to flush fee estimates to fee_estimates.dat.
+static constexpr std::chrono::hours FEE_FLUSH_INTERVAL{1};
+
class AutoFile;
class CTxMemPoolEntry;
class TxConfirmStats;
@@ -239,6 +244,10 @@ public:
void Flush()
EXCLUSIVE_LOCKS_REQUIRED(!m_cs_fee_estimator);
+ /** Record current fee estimations. */
+ void FlushFeeEstimates()
+ EXCLUSIVE_LOCKS_REQUIRED(!m_cs_fee_estimator);
+
private:
mutable Mutex m_cs_fee_estimator;