Skip to content

Commit ddddbac

Browse files
author
MarcoFalke
committed
fees: Pin required version to 149900
There is no need to compare the field to CLIENT_VERSION. Either the format remains compatible and the value can be left unchanged, or it is incompatible and the value needs to be increased to at least 289900+1.
1 parent fa5126a commit ddddbac

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/policy/fees.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
#include <policy/fees.h>
77

8-
#include <clientversion.h>
98
#include <common/system.h>
109
#include <consensus/amount.h>
1110
#include <kernel/mempool_entry.h>
@@ -32,6 +31,10 @@
3231
#include <stdexcept>
3332
#include <utility>
3433

34+
// The current format written, and the version required to read. Must be
35+
// increased to at least 289900+1 on the next breaking change.
36+
constexpr int CURRENT_FEES_FILE_VERSION{149900};
37+
3538
static constexpr double INF_FEERATE = 1e99;
3639

3740
std::string StringForFeeEstimateHorizon(FeeEstimateHorizon horizon)
@@ -961,7 +964,7 @@ bool CBlockPolicyEstimator::Write(AutoFile& fileout) const
961964
{
962965
try {
963966
LOCK(m_cs_fee_estimator);
964-
fileout << 149900; // version required to read: 0.14.99 or later
967+
fileout << CURRENT_FEES_FILE_VERSION;
965968
fileout << int{0}; // Unused dummy field. Written files may contain any value in [0, 289900]
966969
fileout << nBestSeenHeight;
967970
if (BlockSpan() > HistoricalBlockSpan()/2) {
@@ -988,7 +991,7 @@ bool CBlockPolicyEstimator::Read(AutoFile& filein)
988991
LOCK(m_cs_fee_estimator);
989992
int nVersionRequired, dummy;
990993
filein >> nVersionRequired >> dummy;
991-
if (nVersionRequired > CLIENT_VERSION) {
994+
if (nVersionRequired > CURRENT_FEES_FILE_VERSION) {
992995
throw std::runtime_error(strprintf("up-version (%d) fee estimate file", nVersionRequired));
993996
}
994997

@@ -997,9 +1000,9 @@ bool CBlockPolicyEstimator::Read(AutoFile& filein)
9971000
unsigned int nFileBestSeenHeight;
9981001
filein >> nFileBestSeenHeight;
9991002

1000-
if (nVersionRequired < 149900) {
1003+
if (nVersionRequired < CURRENT_FEES_FILE_VERSION) {
10011004
LogPrintf("%s: incompatible old fee estimation data (non-fatal). Version: %d\n", __func__, nVersionRequired);
1002-
} else { // New format introduced in 149900
1005+
} else { // nVersionRequired == CURRENT_FEES_FILE_VERSION
10031006
unsigned int nFileHistoricalFirst, nFileHistoricalBest;
10041007
filein >> nFileHistoricalFirst >> nFileHistoricalBest;
10051008
if (nFileHistoricalFirst > nFileHistoricalBest || nFileHistoricalBest > nFileBestSeenHeight) {

0 commit comments

Comments
 (0)