mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-21 15:50:07 +01:00
Fix calling mempool directly, instead of pool, in ATMP
This commit is contained in:
21
src/main.cpp
21
src/main.cpp
@@ -740,17 +740,14 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state)
|
||||
return true;
|
||||
}
|
||||
|
||||
CAmount GetMinRelayFee(const CTransaction& tx, unsigned int nBytes, bool fAllowFree)
|
||||
CAmount GetMinRelayFee(const CTransaction& tx, const CTxMemPool& pool, unsigned int nBytes, bool fAllowFree)
|
||||
{
|
||||
{
|
||||
LOCK(mempool.cs);
|
||||
uint256 hash = tx.GetHash();
|
||||
double dPriorityDelta = 0;
|
||||
CAmount nFeeDelta = 0;
|
||||
mempool.ApplyDeltas(hash, dPriorityDelta, nFeeDelta);
|
||||
if (dPriorityDelta > 0 || nFeeDelta > 0)
|
||||
return 0;
|
||||
}
|
||||
uint256 hash = tx.GetHash();
|
||||
double dPriorityDelta = 0;
|
||||
CAmount nFeeDelta = 0;
|
||||
pool.ApplyDeltas(hash, dPriorityDelta, nFeeDelta);
|
||||
if (dPriorityDelta > 0 || nFeeDelta > 0)
|
||||
return 0;
|
||||
|
||||
CAmount nMinFee = ::minRelayTxFee.GetFee(nBytes);
|
||||
|
||||
@@ -879,11 +876,11 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
|
||||
CAmount nFees = nValueIn-nValueOut;
|
||||
double dPriority = view.GetPriority(tx, chainActive.Height());
|
||||
|
||||
CTxMemPoolEntry entry(tx, nFees, GetTime(), dPriority, chainActive.Height(), mempool.HasNoInputsOf(tx));
|
||||
CTxMemPoolEntry entry(tx, nFees, GetTime(), dPriority, chainActive.Height(), pool.HasNoInputsOf(tx));
|
||||
unsigned int nSize = entry.GetTxSize();
|
||||
|
||||
// Don't accept it if it can't get into a block
|
||||
CAmount txMinFee = GetMinRelayFee(tx, nSize, true);
|
||||
CAmount txMinFee = GetMinRelayFee(tx, pool, nSize, true);
|
||||
if (fLimitFree && nFees < txMinFee)
|
||||
return state.DoS(0, false, REJECT_INSUFFICIENTFEE, "insufficient fee", false,
|
||||
strprintf("%d < %d", nFees, txMinFee));
|
||||
|
||||
Reference in New Issue
Block a user