mirror of
https://github.com/dogecoin/dogecoin.git
synced 2026-01-31 02:20:53 +00:00
Merge pull request #3433 from patricklodder/1.14.7-discard-old-feefile
policy: only load fee_estimates.dat from 1.14.7 and later
This commit is contained in:
commit
a08d6f6635
@ -890,7 +890,7 @@ CTxMemPool::WriteFeeEstimates(CAutoFile& fileout) const
|
||||
{
|
||||
try {
|
||||
LOCK(cs);
|
||||
fileout << 139900; // version required to read: 0.13.99 or later
|
||||
fileout << FEEFILE_MIN_BACKCOMPAT_VERSION;
|
||||
fileout << CLIENT_VERSION; // version that wrote the file
|
||||
minerPolicyEstimator->Write(fileout);
|
||||
}
|
||||
@ -909,6 +909,16 @@ CTxMemPool::ReadFeeEstimates(CAutoFile& filein)
|
||||
filein >> nVersionRequired >> nVersionThatWrote;
|
||||
if (nVersionRequired > CLIENT_VERSION)
|
||||
return error("CTxMemPool::ReadFeeEstimates(): up-version (%d) fee estimate file", nVersionRequired);
|
||||
|
||||
/* From 1.14.7, only accept fee estimate files created by a version equal to or higher than the
|
||||
* minimum writer version.
|
||||
*
|
||||
* If in the future any of the MIN_FEERATE, MAX_FEERATE or FEE_SPACING in policy/fees.h change,
|
||||
* or these values become configurable, this logic will need to be adapted. */
|
||||
if (nVersionThatWrote < FEEFILE_MIN_COMPAT_VERSION_WRITER) {
|
||||
return error("CTxMemPool::ReadFeeEstimates(): cannot re-use fee estimate files from version %d, ignoring file (non-fatal)", nVersionThatWrote);
|
||||
}
|
||||
|
||||
LOCK(cs);
|
||||
minerPolicyEstimator->Read(filein, nVersionThatWrote);
|
||||
}
|
||||
|
||||
@ -31,6 +31,19 @@
|
||||
class CAutoFile;
|
||||
class CBlockIndex;
|
||||
|
||||
/** Minimum client version required to read fee_estimates.dat
|
||||
* Clients with a lower version than this should ignore the file
|
||||
*/
|
||||
static const int FEEFILE_MIN_BACKCOMPAT_VERSION = 1140700; // 1.14.7.0
|
||||
|
||||
/** Minimum client version required to read fee_estimates.dat
|
||||
* Files created with a lower version than this are ignored
|
||||
*
|
||||
* Due to bucket spacing and min/max changes in 1.14.7, set this
|
||||
* to 1.14.7.0 exactly.
|
||||
*/
|
||||
static const int FEEFILE_MIN_COMPAT_VERSION_WRITER = 1140700; // 1.14.7.0
|
||||
|
||||
inline double AllowFreeThreshold()
|
||||
{
|
||||
return COIN * 144 / 250;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user