5
5
6
6
#include < policy/fees.h>
7
7
8
- #include < clientversion.h>
9
8
#include < common/system.h>
10
9
#include < consensus/amount.h>
11
10
#include < kernel/mempool_entry.h>
32
31
#include < stdexcept>
33
32
#include < utility>
34
33
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
+
35
38
static constexpr double INF_FEERATE = 1e99 ;
36
39
37
40
std::string StringForFeeEstimateHorizon (FeeEstimateHorizon horizon)
@@ -961,7 +964,7 @@ bool CBlockPolicyEstimator::Write(AutoFile& fileout) const
961
964
{
962
965
try {
963
966
LOCK (m_cs_fee_estimator);
964
- fileout << 149900 ; // version required to read: 0.14.99 or later
967
+ fileout << CURRENT_FEES_FILE_VERSION;
965
968
fileout << int {0 }; // Unused dummy field. Written files may contain any value in [0, 289900]
966
969
fileout << nBestSeenHeight;
967
970
if (BlockSpan () > HistoricalBlockSpan ()/2 ) {
@@ -988,7 +991,7 @@ bool CBlockPolicyEstimator::Read(AutoFile& filein)
988
991
LOCK (m_cs_fee_estimator);
989
992
int nVersionRequired, dummy;
990
993
filein >> nVersionRequired >> dummy;
991
- if (nVersionRequired > CLIENT_VERSION ) {
994
+ if (nVersionRequired > CURRENT_FEES_FILE_VERSION ) {
992
995
throw std::runtime_error (strprintf (" up-version (%d) fee estimate file" , nVersionRequired));
993
996
}
994
997
@@ -997,9 +1000,9 @@ bool CBlockPolicyEstimator::Read(AutoFile& filein)
997
1000
unsigned int nFileBestSeenHeight;
998
1001
filein >> nFileBestSeenHeight;
999
1002
1000
- if (nVersionRequired < 149900 ) {
1003
+ if (nVersionRequired < CURRENT_FEES_FILE_VERSION ) {
1001
1004
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
1003
1006
unsigned int nFileHistoricalFirst, nFileHistoricalBest;
1004
1007
filein >> nFileHistoricalFirst >> nFileHistoricalBest;
1005
1008
if (nFileHistoricalFirst > nFileHistoricalBest || nFileHistoricalBest > nFileBestSeenHeight) {
0 commit comments