aboutsummaryrefslogtreecommitdiff
path: root/src/policy
diff options
context:
space:
mode:
authorMurch <uwblp@student.kit.edu>2017-09-06 16:37:09 -0700
committerMurch <uwblp@student.kit.edu>2017-09-07 15:58:36 -0700
commit3a3a9f978ba625d9d1f645810e81ecbc3cfb86ae (patch)
tree9f0137d0a942f986f811d8f2c20b45bbaab6dcbd /src/policy
parent089b742a210bf2d62f0e473faa70b30c1b06b657 (diff)
downloadbitcoin-3a3a9f978ba625d9d1f645810e81ecbc3cfb86ae.tar.xz
Ignore old format estimation file
Diffstat (limited to 'src/policy')
-rw-r--r--src/policy/fees.cpp29
1 files changed, 3 insertions, 26 deletions
diff --git a/src/policy/fees.cpp b/src/policy/fees.cpp
index b9476407cf..c26d99cfce 100644
--- a/src/policy/fees.cpp
+++ b/src/policy/fees.cpp
@@ -944,32 +944,9 @@ bool CBlockPolicyEstimator::Read(CAutoFile& filein)
unsigned int nFileBestSeenHeight;
filein >> nFileBestSeenHeight;
- if (nVersionThatWrote < 149900) {
- // Read the old fee estimates file for temporary use, but then discard. Will start collecting data from scratch.
- // decay is stored before buckets in old versions, so pre-read decay and pass into TxConfirmStats constructor
- double tempDecay;
- filein >> tempDecay;
- if (tempDecay <= 0 || tempDecay >= 1)
- throw std::runtime_error("Corrupt estimates file. Decay must be between 0 and 1 (non-inclusive)");
-
- std::vector<double> tempBuckets;
- filein >> tempBuckets;
- size_t tempNum = tempBuckets.size();
- if (tempNum <= 1 || tempNum > 1000)
- throw std::runtime_error("Corrupt estimates file. Must have between 2 and 1000 feerate buckets");
-
- std::map<double, unsigned int> tempMap;
-
- std::unique_ptr<TxConfirmStats> tempFeeStats(new TxConfirmStats(tempBuckets, tempMap, MED_BLOCK_PERIODS, tempDecay, 1));
- tempFeeStats->Read(filein, nVersionThatWrote, tempNum);
- // if nVersionThatWrote < 139900 then another TxConfirmStats (for priority) follows but can be ignored.
-
- tempMap.clear();
- for (unsigned int i = 0; i < tempBuckets.size(); i++) {
- tempMap[tempBuckets[i]] = i;
- }
- }
- else { // nVersionThatWrote >= 149900
+ if (nVersionRequired < 149900) {
+ LogPrintf("%s: incompatible old fee estimation data (non-fatal). Version: %d\n", __func__, nVersionRequired);
+ } else { // New format introduced in 149900
unsigned int nFileHistoricalFirst, nFileHistoricalBest;
filein >> nFileHistoricalFirst >> nFileHistoricalBest;
if (nFileHistoricalFirst > nFileHistoricalBest || nFileHistoricalBest > nFileBestSeenHeight) {