|
|
|
@ -384,7 +384,7 @@ static void UpdateMempoolForReorg(CTxMemPool& mempool, DisconnectedBlockTransact
|
|
|
|
|
TxValidationState stateDummy;
|
|
|
|
|
if (!fAddToMempool || (*it)->IsCoinBase() ||
|
|
|
|
|
!AcceptToMemoryPool(mempool, stateDummy, *it,
|
|
|
|
|
nullptr /* plTxnReplaced */, true /* bypass_limits */, 0 /* nAbsurdFee */)) {
|
|
|
|
|
nullptr /* plTxnReplaced */, true /* bypass_limits */)) {
|
|
|
|
|
// If the transaction doesn't make it in to the mempool, remove any
|
|
|
|
|
// transactions that depend on it (which would now be orphans).
|
|
|
|
|
mempool.removeRecursive(**it, MemPoolRemovalReason::REORG);
|
|
|
|
@ -463,7 +463,6 @@ public:
|
|
|
|
|
const int64_t m_accept_time;
|
|
|
|
|
std::list<CTransactionRef>* m_replaced_transactions;
|
|
|
|
|
const bool m_bypass_limits;
|
|
|
|
|
const CAmount& m_absurd_fee;
|
|
|
|
|
/*
|
|
|
|
|
* Return any outpoints which were not previously present in the coins
|
|
|
|
|
* cache, but were added as a result of validating the tx for mempool
|
|
|
|
@ -558,7 +557,6 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws)
|
|
|
|
|
TxValidationState &state = args.m_state;
|
|
|
|
|
const int64_t nAcceptTime = args.m_accept_time;
|
|
|
|
|
const bool bypass_limits = args.m_bypass_limits;
|
|
|
|
|
const CAmount& nAbsurdFee = args.m_absurd_fee;
|
|
|
|
|
std::vector<COutPoint>& coins_to_uncache = args.m_coins_to_uncache;
|
|
|
|
|
|
|
|
|
|
// Alias what we need out of ws
|
|
|
|
@ -729,9 +727,6 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws)
|
|
|
|
|
// blocks
|
|
|
|
|
if (!bypass_limits && !CheckFeeRate(nSize, nModifiedFees, state)) return false;
|
|
|
|
|
|
|
|
|
|
if (nAbsurdFee && nFees > nAbsurdFee)
|
|
|
|
|
LogPrintf("Ignoring Absurdfee\n");
|
|
|
|
|
|
|
|
|
|
const CTxMemPool::setEntries setIterConflicting = m_pool.GetIterSet(setConflicts);
|
|
|
|
|
// Calculate in-mempool ancestors, up to a limit.
|
|
|
|
|
if (setConflicts.size() == 1) {
|
|
|
|
@ -1064,10 +1059,10 @@ bool MemPoolAccept::AcceptSingleTransaction(const CTransactionRef& ptx, ATMPArgs
|
|
|
|
|
/** (try to) add transaction to memory pool with a specified acceptance time **/
|
|
|
|
|
static bool AcceptToMemoryPoolWithTime(const CChainParams& chainparams, CTxMemPool& pool, TxValidationState &state, const CTransactionRef &tx,
|
|
|
|
|
int64_t nAcceptTime, std::list<CTransactionRef>* plTxnReplaced,
|
|
|
|
|
bool bypass_limits, const CAmount nAbsurdFee, bool test_accept, CAmount* fee_out=nullptr) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
|
|
|
|
|
bool bypass_limits, bool test_accept, CAmount* fee_out=nullptr) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
|
|
|
|
|
{
|
|
|
|
|
std::vector<COutPoint> coins_to_uncache;
|
|
|
|
|
MemPoolAccept::ATMPArgs args { chainparams, state, nAcceptTime, plTxnReplaced, bypass_limits, nAbsurdFee, coins_to_uncache, test_accept, fee_out };
|
|
|
|
|
MemPoolAccept::ATMPArgs args { chainparams, state, nAcceptTime, plTxnReplaced, bypass_limits, coins_to_uncache, test_accept, fee_out };
|
|
|
|
|
bool res = MemPoolAccept(pool).AcceptSingleTransaction(tx, args);
|
|
|
|
|
if (!res) {
|
|
|
|
|
// Remove coins that were not present in the coins cache before calling ATMPW;
|
|
|
|
@ -1086,10 +1081,10 @@ static bool AcceptToMemoryPoolWithTime(const CChainParams& chainparams, CTxMemPo
|
|
|
|
|
|
|
|
|
|
bool AcceptToMemoryPool(CTxMemPool& pool, TxValidationState &state, const CTransactionRef &tx,
|
|
|
|
|
std::list<CTransactionRef>* plTxnReplaced,
|
|
|
|
|
bool bypass_limits, const CAmount nAbsurdFee, bool test_accept, CAmount* fee_out)
|
|
|
|
|
bool bypass_limits, bool test_accept, CAmount* fee_out)
|
|
|
|
|
{
|
|
|
|
|
const CChainParams& chainparams = Params();
|
|
|
|
|
return AcceptToMemoryPoolWithTime(chainparams, pool, state, tx, GetTime(), plTxnReplaced, bypass_limits, nAbsurdFee, test_accept, fee_out);
|
|
|
|
|
return AcceptToMemoryPoolWithTime(chainparams, pool, state, tx, GetTime(), plTxnReplaced, bypass_limits, test_accept, fee_out);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CTransactionRef GetTransaction(const CBlockIndex* const block_index, const CTxMemPool* const mempool, const uint256& hash, const Consensus::Params& consensusParams, uint256& hashBlock)
|
|
|
|
@ -5078,7 +5073,7 @@ bool LoadMempool(CTxMemPool& pool)
|
|
|
|
|
if (nTime + nExpiryTimeout > nNow) {
|
|
|
|
|
LOCK(cs_main);
|
|
|
|
|
AcceptToMemoryPoolWithTime(chainparams, pool, state, tx, nTime,
|
|
|
|
|
nullptr /* plTxnReplaced */, false /* bypass_limits */, 0 /* nAbsurdFee */,
|
|
|
|
|
nullptr /* plTxnReplaced */, false /* bypass_limits */,
|
|
|
|
|
false /* test_accept */);
|
|
|
|
|
if (state.IsValid()) {
|
|
|
|
|
++count;
|
|
|
|
|