aboutsummaryrefslogtreecommitdiff
path: root/src/policy/fees.h
diff options
context:
space:
mode:
authorismaelsadeeq <ask4ismailsadiq@gmail.com>2023-06-14 22:32:27 +0100
committerismaelsadeeq <ask4ismailsadiq@gmail.com>2023-06-14 22:32:27 +0100
commit3eb241a141defa564c94cb95c5bbaf4c5bd9682e (patch)
tree26400572a296470d7df1c9e55397a31115ec7846 /src/policy/fees.h
parent5b886f2b436eaa8c2b7de58dc4644dc6223040da (diff)
downloadbitcoin-3eb241a141defa564c94cb95c5bbaf4c5bd9682e.tar.xz
tx fees, policy: do not read estimates of old fee_estimates.dat
Old fee estimates could cause transactions to become stuck in the mempool. This commit prevents the node from using stale estimates from an old file.
Diffstat (limited to 'src/policy/fees.h')
-rw-r--r--src/policy/fees.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/policy/fees.h b/src/policy/fees.h
index a6c45839b9..a348ba05d8 100644
--- a/src/policy/fees.h
+++ b/src/policy/fees.h
@@ -25,6 +25,11 @@
// How often to flush fee estimates to fee_estimates.dat.
static constexpr std::chrono::hours FEE_FLUSH_INTERVAL{1};
+/** fee_estimates.dat that are more than 60 hours (2.5 days) will not be read,
+ * as the estimates in the file are stale.
+ */
+static constexpr std::chrono::hours MAX_FILE_AGE{60};
+
class AutoFile;
class CTxMemPoolEntry;
class TxConfirmStats;
@@ -248,6 +253,9 @@ public:
void FlushFeeEstimates()
EXCLUSIVE_LOCKS_REQUIRED(!m_cs_fee_estimator);
+ /** Calculates the age of the file, since last modified */
+ std::chrono::hours GetFeeEstimatorFileAge();
+
private:
mutable Mutex m_cs_fee_estimator;