Changeset View
Changeset View
Standalone View
Standalone View
src/txmempool.cpp
Show All 16 Lines | |||||
#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 <boost/range/adaptor/reversed.hpp> | #include <boost/range/adaptor/reversed.hpp> | ||||
#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 926 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 blocks | |||||
// include low fee | |||||
// transactions, but the mempool is being spammed. | |||||
// Therefore, use the maximum of the two values. | |||||
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); | ||||
return minerPolicyEstimator->estimateSmartFee(nBlocks, answerFoundAtBlocks, | uint64_t maxMempoolSize = | ||||
*this); | 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 blocks | |||||
// include low fee | |||||
// transactions, but the mempool is being spammed. | |||||
// Therefore, use the maximum of the two values. | |||||
return std::max(minerPolicyEstimator->estimateSmartFee( | |||||
nBlocks, answerFoundAtBlocks, *this), | |||||
GetMinFee(maxMempoolSize)); | |||||
} | } | ||||
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 | ||||
fileout << 139900; | fileout << 139900; | ||||
// version that wrote the file | // version that wrote the file | ||||
▲ Show 20 Lines • Show All 423 Lines • Show Last 20 Lines |