|
|
|
@ -511,7 +511,7 @@ void TxConfirmStats::removeTx(unsigned int entryHeight, unsigned int nBestSeenHe
|
|
|
|
|
// of no harm to try to remove them again.
|
|
|
|
|
bool CBlockPolicyEstimator::removeTx(uint256 hash, bool inBlock)
|
|
|
|
|
{
|
|
|
|
|
LOCK(cs_feeEstimator);
|
|
|
|
|
LOCK(m_cs_fee_estimator);
|
|
|
|
|
std::map<uint256, TxStatsInfo>::iterator pos = mapMemPoolTxs.find(hash);
|
|
|
|
|
if (pos != mapMemPoolTxs.end()) {
|
|
|
|
|
feeStats->removeTx(pos->second.blockHeight, nBestSeenHeight, pos->second.bucketIndex, inBlock);
|
|
|
|
@ -548,7 +548,7 @@ CBlockPolicyEstimator::~CBlockPolicyEstimator()
|
|
|
|
|
|
|
|
|
|
void CBlockPolicyEstimator::processTransaction(const CTxMemPoolEntry& entry, bool validFeeEstimate)
|
|
|
|
|
{
|
|
|
|
|
LOCK(cs_feeEstimator);
|
|
|
|
|
LOCK(m_cs_fee_estimator);
|
|
|
|
|
unsigned int txHeight = entry.GetHeight();
|
|
|
|
|
uint256 hash = entry.GetTx().GetHash();
|
|
|
|
|
if (mapMemPoolTxs.count(hash)) {
|
|
|
|
@ -615,7 +615,7 @@ bool CBlockPolicyEstimator::processBlockTx(unsigned int nBlockHeight, const CTxM
|
|
|
|
|
void CBlockPolicyEstimator::processBlock(unsigned int nBlockHeight,
|
|
|
|
|
std::vector<const CTxMemPoolEntry*>& entries)
|
|
|
|
|
{
|
|
|
|
|
LOCK(cs_feeEstimator);
|
|
|
|
|
LOCK(m_cs_fee_estimator);
|
|
|
|
|
if (nBlockHeight <= nBestSeenHeight) {
|
|
|
|
|
// Ignore side chains and re-orgs; assuming they are random
|
|
|
|
|
// they don't affect the estimate.
|
|
|
|
@ -693,7 +693,7 @@ CFeeRate CBlockPolicyEstimator::estimateRawFee(int confTarget, double successThr
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LOCK(cs_feeEstimator);
|
|
|
|
|
LOCK(m_cs_fee_estimator);
|
|
|
|
|
// Return failure if trying to analyze a target we're not tracking
|
|
|
|
|
if (confTarget <= 0 || (unsigned int)confTarget > stats->GetMaxConfirms())
|
|
|
|
|
return CFeeRate(0);
|
|
|
|
@ -819,7 +819,7 @@ double CBlockPolicyEstimator::estimateConservativeFee(unsigned int doubleTarget,
|
|
|
|
|
*/
|
|
|
|
|
CFeeRate CBlockPolicyEstimator::estimateSmartFee(int confTarget, FeeCalculation *feeCalc, bool conservative) const
|
|
|
|
|
{
|
|
|
|
|
LOCK(cs_feeEstimator);
|
|
|
|
|
LOCK(m_cs_fee_estimator);
|
|
|
|
|
|
|
|
|
|
if (feeCalc) {
|
|
|
|
|
feeCalc->desiredTarget = confTarget;
|
|
|
|
@ -899,7 +899,7 @@ CFeeRate CBlockPolicyEstimator::estimateSmartFee(int confTarget, FeeCalculation
|
|
|
|
|
bool CBlockPolicyEstimator::Write(CAutoFile& fileout) const
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
LOCK(cs_feeEstimator);
|
|
|
|
|
LOCK(m_cs_fee_estimator);
|
|
|
|
|
fileout << 149900; // version required to read: 0.14.99 or later
|
|
|
|
|
fileout << CLIENT_VERSION; // version that wrote the file
|
|
|
|
|
fileout << nBestSeenHeight;
|
|
|
|
@ -924,7 +924,7 @@ bool CBlockPolicyEstimator::Write(CAutoFile& fileout) const
|
|
|
|
|
bool CBlockPolicyEstimator::Read(CAutoFile& filein)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
LOCK(cs_feeEstimator);
|
|
|
|
|
LOCK(m_cs_fee_estimator);
|
|
|
|
|
int nVersionRequired, nVersionThatWrote;
|
|
|
|
|
filein >> nVersionRequired >> nVersionThatWrote;
|
|
|
|
|
if (nVersionRequired > CLIENT_VERSION)
|
|
|
|
@ -983,7 +983,7 @@ bool CBlockPolicyEstimator::Read(CAutoFile& filein)
|
|
|
|
|
|
|
|
|
|
void CBlockPolicyEstimator::FlushUnconfirmed() {
|
|
|
|
|
int64_t startclear = GetTimeMicros();
|
|
|
|
|
LOCK(cs_feeEstimator);
|
|
|
|
|
LOCK(m_cs_fee_estimator);
|
|
|
|
|
size_t num_entries = mapMemPoolTxs.size();
|
|
|
|
|
// Remove every entry in mapMemPoolTxs
|
|
|
|
|
while (!mapMemPoolTxs.empty()) {
|
|
|
|
|