mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-16 13:01:19 +02:00
Limit variable scope
This commit is contained in:
parent
f259263a7b
commit
90593ed92c
11 changed files with 21 additions and 23 deletions
|
|
@ -855,13 +855,13 @@ bool CBlockPolicyEstimator::Read(CAutoFile& filein)
|
|||
try {
|
||||
LOCK(cs_feeEstimator);
|
||||
int nVersionRequired, nVersionThatWrote;
|
||||
unsigned int nFileBestSeenHeight, nFileHistoricalFirst, nFileHistoricalBest;
|
||||
filein >> nVersionRequired >> nVersionThatWrote;
|
||||
if (nVersionRequired > CLIENT_VERSION)
|
||||
return error("CBlockPolicyEstimator::Read(): up-version (%d) fee estimate file", nVersionRequired);
|
||||
|
||||
// Read fee estimates file into temporary variables so existing data
|
||||
// structures aren't corrupted if there is an exception.
|
||||
unsigned int nFileBestSeenHeight;
|
||||
filein >> nFileBestSeenHeight;
|
||||
|
||||
if (nVersionThatWrote < 149900) {
|
||||
|
|
@ -890,6 +890,7 @@ bool CBlockPolicyEstimator::Read(CAutoFile& filein)
|
|||
}
|
||||
}
|
||||
else { // nVersionThatWrote >= 149900
|
||||
unsigned int nFileHistoricalFirst, nFileHistoricalBest;
|
||||
filein >> nFileHistoricalFirst >> nFileHistoricalBest;
|
||||
if (nFileHistoricalFirst > nFileHistoricalBest || nFileHistoricalBest > nFileBestSeenHeight) {
|
||||
throw std::runtime_error("Corrupt estimates file. Historical block range for estimates is invalid");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue