diff options
| author | Wladimir J. van der Laan <[email protected]> | 2017-12-19 17:03:27 +0100 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2017-12-19 17:09:59 +0100 |
| commit | cdd6bbf10a818d243f973f628e465cc1df98691a (patch) | |
| tree | f2e1f54dc2423f0acd438e1af97f41343a6668cb /src/policy/fees.cpp | |
| parent | Merge #11923: Wallet : remove unused fNoncriticalErrors variable from CWallet... (diff) | |
| parent | Ignore old format estimation file (diff) | |
| download | discoin-cdd6bbf10a818d243f973f628e465cc1df98691a.tar.xz discoin-cdd6bbf10a818d243f973f628e465cc1df98691a.zip | |
Merge #11273: Ignore old format estimation file
3a3a9f9 Ignore old format estimation file (Murch)
Pull request description:
The fee estimation data format changed from 0.14.x to 0.15.0, so we should no longer read the old data. H/T @jnewbery, @morcos
Pending testing.
Tree-SHA512: c8e3824dbdd8f6730133d5ad20b00995e9a63ab54431158a91e2f4d2aba5763b8aa698bce1fffca2713ba3a162e23d8fcd6e3efb9847b015c2e1e8725398150b
Diffstat (limited to 'src/policy/fees.cpp')
| -rw-r--r-- | src/policy/fees.cpp | 29 |
1 files changed, 3 insertions, 26 deletions
diff --git a/src/policy/fees.cpp b/src/policy/fees.cpp index dc88c4f91..b06b9953f 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) { |