|
|
|
@ -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));
|
|
|
|
|