Skip to content

Commit

Permalink
Merge bitcoin#11951: Remove dead feeest-file read code for old versions
Browse files Browse the repository at this point in the history
62e7c04 Remove dead feeest-file read code for old versions (Matt Corallo)

Pull request description:

  0.15.0 introduced a new feeest file format, and support for parsing
  old versions was never fully added. We now simply fail to read the
  old format, so remove the dead partial-implementation.

  Follow up to bitcoin#11273.

Tree-SHA512: c291ce51b7cb0c93479c18a1885dd646cbe03e4c7d12df03c0e99c0634e1bf9f9e41facf54a645227154bab58b9988f21b928cf3fc0520087c4eede4258c8861
  • Loading branch information
laanwj authored and PastaPastaPasta committed Feb 27, 2020
1 parent df30971 commit 4a7a7cd
Showing 1 changed file with 14 additions and 23 deletions.
37 changes: 14 additions & 23 deletions src/policy/fees.cpp
Expand Up @@ -412,15 +412,13 @@ void TxConfirmStats::Read(CAutoFile& filein, int nFileVersion, size_t numBuckets
size_t maxConfirms, maxPeriods;

// The current version will store the decay with each individual TxConfirmStats and also keep a scale factor
if (nFileVersion >= 140100) {
filein >> decay;
if (decay <= 0 || decay >= 1) {
throw std::runtime_error("Corrupt estimates file. Decay must be between 0 and 1 (non-inclusive)");
}
filein >> scale;
if (scale == 0) {
throw std::runtime_error("Corrupt estimates file. Scale must be non-zero");
}
filein >> decay;
if (decay <= 0 || decay >= 1) {
throw std::runtime_error("Corrupt estimates file. Decay must be between 0 and 1 (non-inclusive)");
}
filein >> scale;
if (scale == 0) {
throw std::runtime_error("Corrupt estimates file. Scale must be non-zero");
}

filein >> avg;
Expand All @@ -444,20 +442,13 @@ void TxConfirmStats::Read(CAutoFile& filein, int nFileVersion, size_t numBuckets
}
}

if (nFileVersion >= 140100) {
filein >> failAvg;
if (maxPeriods != failAvg.size()) {
throw std::runtime_error("Corrupt estimates file. Mismatch in confirms tracked for failures");
}
for (unsigned int i = 0; i < maxPeriods; i++) {
if (failAvg[i].size() != numBuckets) {
throw std::runtime_error("Corrupt estimates file. Mismatch in one of failure average bucket counts");
}
}
} else {
failAvg.resize(confAvg.size());
for (unsigned int i = 0; i < failAvg.size(); i++) {
failAvg[i].resize(numBuckets);
filein >> failAvg;
if (maxPeriods != failAvg.size()) {
throw std::runtime_error("Corrupt estimates file. Mismatch in confirms tracked for failures");
}
for (unsigned int i = 0; i < maxPeriods; i++) {
if (failAvg[i].size() != numBuckets) {
throw std::runtime_error("Corrupt estimates file. Mismatch in one of failure average bucket counts");
}
}

Expand Down

0 comments on commit 4a7a7cd

Please sign in to comment.