From 6939a7248fb04333d4341cf0ad82116cbd67ca4f Mon Sep 17 00:00:00 2001 From: Steven Roose Date: Wed, 25 Mar 2020 14:37:15 +0000 Subject: [PATCH] Support fee estimation for fees lower than 1 sat/byte --- src/policy/fees.cpp | 7 ++++++- src/policy/fees.h | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/policy/fees.cpp b/src/policy/fees.cpp index c49b9fa36b..764d4f137f 100644 --- a/src/policy/fees.cpp +++ b/src/policy/fees.cpp @@ -901,7 +901,9 @@ bool CBlockPolicyEstimator::Write(CAutoFile& fileout) const { try { LOCK(m_cs_fee_estimator); - fileout << 149900; // version required to read: 0.14.99 or later + //ELEMENTS: We upped this from 0.14.99 in upstream because + // we changed the bucket sizes. + fileout << 180107; // version required to read: 0.18.1.7 fileout << CLIENT_VERSION; // version that wrote the file fileout << nBestSeenHeight; if (BlockSpan() > HistoricalBlockSpan()/2) { @@ -938,6 +940,9 @@ bool CBlockPolicyEstimator::Read(CAutoFile& filein) if (nVersionRequired < 149900) { LogPrintf("%s: incompatible old fee estimation data (non-fatal). Version: %d\n", __func__, nVersionRequired); + } else if (nVersionThatWrote < 180107) { + //ELEMENTS: we changed the buckets in 0.18.1.7 + LogPrintf("%s: incompatible old fee estimation data (non-fatal). Version: %d\n", __func__, nVersionThatWrote); } else { // New format introduced in 149900 unsigned int nFileHistoricalFirst, nFileHistoricalBest; filein >> nFileHistoricalFirst >> nFileHistoricalBest; diff --git a/src/policy/fees.h b/src/policy/fees.h index c8472a12f5..81171f00ef 100644 --- a/src/policy/fees.h +++ b/src/policy/fees.h @@ -174,8 +174,8 @@ private: * invalidates old estimates files. So leave it at 1000 unless it becomes * necessary to lower it, and then lower it substantially. */ - static constexpr double MIN_BUCKET_FEERATE = 1000; - static constexpr double MAX_BUCKET_FEERATE = 1e7; + static constexpr double MIN_BUCKET_FEERATE = 100; + static constexpr double MAX_BUCKET_FEERATE = 1e6; /** Spacing of FeeRate buckets * We have to lump transactions into buckets based on feerate, but we want to be able