Changeset View
Changeset View
Standalone View
Standalone View
src/txmempool.cpp
Show All 15 Lines | |||||
#include "streams.h" | #include "streams.h" | ||||
#include "timedata.h" | #include "timedata.h" | ||||
#include "util.h" | #include "util.h" | ||||
#include "utilmoneystr.h" | #include "utilmoneystr.h" | ||||
#include "utiltime.h" | #include "utiltime.h" | ||||
#include "validation.h" | #include "validation.h" | ||||
#include "version.h" | #include "version.h" | ||||
#include <algorithm> | |||||
CTxMemPoolEntry::CTxMemPoolEntry(const CTransactionRef &_tx, const Amount _nFee, | CTxMemPoolEntry::CTxMemPoolEntry(const CTransactionRef &_tx, const Amount _nFee, | ||||
int64_t _nTime, double _entryPriority, | int64_t _nTime, double _entryPriority, | ||||
unsigned int _entryHeight, | unsigned int _entryHeight, | ||||
Amount _inChainInputValue, | Amount _inChainInputValue, | ||||
bool _spendsCoinbase, int64_t _sigOpsCount, | bool _spendsCoinbase, int64_t _sigOpsCount, | ||||
LockPoints lp) | LockPoints lp) | ||||
: tx(_tx), nFee(_nFee), nTime(_nTime), entryPriority(_entryPriority), | : tx(_tx), nFee(_nFee), nTime(_nTime), entryPriority(_entryPriority), | ||||
entryHeight(_entryHeight), inChainInputValue(_inChainInputValue), | entryHeight(_entryHeight), inChainInputValue(_inChainInputValue), | ||||
▲ Show 20 Lines • Show All 922 Lines • ▼ Show 20 Lines | if (i == mapTx.end()) { | ||||
return TxMempoolInfo(); | return TxMempoolInfo(); | ||||
} | } | ||||
return GetInfo(i); | return GetInfo(i); | ||||
} | } | ||||
CFeeRate CTxMemPool::estimateFee(int nBlocks) const { | CFeeRate CTxMemPool::estimateFee(int nBlocks) const { | ||||
LOCK(cs); | LOCK(cs); | ||||
return minerPolicyEstimator->estimateFee(nBlocks); | |||||
uint64_t maxMempoolSize = | |||||
gArgs.GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000; | |||||
// minerPolicy uses recent blocks to figure out a reasonable fee. This | |||||
// may disagree with the rollingMinimumFeerate under certain scenarios | |||||
// where the mempool increases rapidly, or blocks are being mined which | |||||
// do not contain propagated transactions. | |||||
return std::max(minerPolicyEstimator->estimateFee(nBlocks), | |||||
GetMinFee(maxMempoolSize)); | |||||
} | } | ||||
CFeeRate CTxMemPool::estimateSmartFee(int nBlocks, | CFeeRate CTxMemPool::estimateSmartFee(int nBlocks, | ||||
int *answerFoundAtBlocks) const { | int *answerFoundAtBlocks) const { | ||||
LOCK(cs); | LOCK(cs); | ||||
// estimateSmartFee already includes the GetMinFee check, this is the | |||||
// reason it takes `*this`. It does not need std::max as above. | |||||
return minerPolicyEstimator->estimateSmartFee(nBlocks, answerFoundAtBlocks, | return minerPolicyEstimator->estimateSmartFee(nBlocks, answerFoundAtBlocks, | ||||
*this); | *this); | ||||
} | } | ||||
bool CTxMemPool::WriteFeeEstimates(CAutoFile &fileout) const { | bool CTxMemPool::WriteFeeEstimates(CAutoFile &fileout) const { | ||||
try { | try { | ||||
LOCK(cs); | LOCK(cs); | ||||
// version required to read: 0.13.99 or later | // version required to read: 0.13.99 or later | ||||
▲ Show 20 Lines • Show All 425 Lines • Show Last 20 Lines |