Skip to content

Commit fa5126a

Browse files
author
MarcoFalke
committed
fees: Pin "version that wrote" to 0
The field is unused and there is no need to tie it to CLIENT_VERSION and increase it, if the format does not change.
1 parent 5fb9455 commit fa5126a

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/policy/fees.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ class TxConfirmStats
168168
* Read saved state of estimation data from a file and replace all internal data structures and
169169
* variables with this state.
170170
*/
171-
void Read(AutoFile& filein, int nFileVersion, size_t numBuckets);
171+
void Read(AutoFile& filein, size_t numBuckets);
172172
};
173173

174174

@@ -414,7 +414,7 @@ void TxConfirmStats::Write(AutoFile& fileout) const
414414
fileout << Using<VectorFormatter<VectorFormatter<EncodedDoubleFormatter>>>(failAvg);
415415
}
416416

417-
void TxConfirmStats::Read(AutoFile& filein, int nFileVersion, size_t numBuckets)
417+
void TxConfirmStats::Read(AutoFile& filein, size_t numBuckets)
418418
{
419419
// Read data file and do some very basic sanity checking
420420
// buckets and bucketMap are not updated yet, so don't access them
@@ -962,7 +962,7 @@ bool CBlockPolicyEstimator::Write(AutoFile& fileout) const
962962
try {
963963
LOCK(m_cs_fee_estimator);
964964
fileout << 149900; // version required to read: 0.14.99 or later
965-
fileout << CLIENT_VERSION; // version that wrote the file
965+
fileout << int{0}; // Unused dummy field. Written files may contain any value in [0, 289900]
966966
fileout << nBestSeenHeight;
967967
if (BlockSpan() > HistoricalBlockSpan()/2) {
968968
fileout << firstRecordedHeight << nBestSeenHeight;
@@ -986,8 +986,8 @@ bool CBlockPolicyEstimator::Read(AutoFile& filein)
986986
{
987987
try {
988988
LOCK(m_cs_fee_estimator);
989-
int nVersionRequired, nVersionThatWrote;
990-
filein >> nVersionRequired >> nVersionThatWrote;
989+
int nVersionRequired, dummy;
990+
filein >> nVersionRequired >> dummy;
991991
if (nVersionRequired > CLIENT_VERSION) {
992992
throw std::runtime_error(strprintf("up-version (%d) fee estimate file", nVersionRequired));
993993
}
@@ -1015,9 +1015,9 @@ bool CBlockPolicyEstimator::Read(AutoFile& filein)
10151015
std::unique_ptr<TxConfirmStats> fileFeeStats(new TxConfirmStats(buckets, bucketMap, MED_BLOCK_PERIODS, MED_DECAY, MED_SCALE));
10161016
std::unique_ptr<TxConfirmStats> fileShortStats(new TxConfirmStats(buckets, bucketMap, SHORT_BLOCK_PERIODS, SHORT_DECAY, SHORT_SCALE));
10171017
std::unique_ptr<TxConfirmStats> fileLongStats(new TxConfirmStats(buckets, bucketMap, LONG_BLOCK_PERIODS, LONG_DECAY, LONG_SCALE));
1018-
fileFeeStats->Read(filein, nVersionThatWrote, numBuckets);
1019-
fileShortStats->Read(filein, nVersionThatWrote, numBuckets);
1020-
fileLongStats->Read(filein, nVersionThatWrote, numBuckets);
1018+
fileFeeStats->Read(filein, numBuckets);
1019+
fileShortStats->Read(filein, numBuckets);
1020+
fileLongStats->Read(filein, numBuckets);
10211021

10221022
// Fee estimates file parsed correctly
10231023
// Copy buckets from file and refresh our bucketmap

0 commit comments

Comments
 (0)