test
This commit is contained in:
25
src/main.cpp
25
src/main.cpp
@@ -1039,13 +1039,12 @@ CAmount GetMinRelayFee(const CTransaction& tx, unsigned int nBytes, bool fAllowF
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransaction &tx, bool fLimitFree,
|
bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransaction &tx, bool fLimitFree,bool* pfMissingInputs, bool fRejectAbsurdFee)
|
||||||
bool* pfMissingInputs, bool fRejectAbsurdFee)
|
|
||||||
{
|
{
|
||||||
AssertLockHeld(cs_main);
|
AssertLockHeld(cs_main);
|
||||||
if (pfMissingInputs)
|
if (pfMissingInputs)
|
||||||
*pfMissingInputs = false;
|
*pfMissingInputs = false;
|
||||||
|
fprintf(stderr,"AcceptToMemoryPool\n");
|
||||||
if (!CheckTransaction(tx, state))
|
if (!CheckTransaction(tx, state))
|
||||||
return error("AcceptToMemoryPool: CheckTransaction failed");
|
return error("AcceptToMemoryPool: CheckTransaction failed");
|
||||||
|
|
||||||
@@ -1057,8 +1056,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
|
|||||||
// Rather not work on nonstandard transactions (unless -testnet/-regtest)
|
// Rather not work on nonstandard transactions (unless -testnet/-regtest)
|
||||||
string reason;
|
string reason;
|
||||||
if (Params().RequireStandard() && !IsStandardTx(tx, reason))
|
if (Params().RequireStandard() && !IsStandardTx(tx, reason))
|
||||||
return state.DoS(0,
|
return state.DoS(0,error("AcceptToMemoryPool: nonstandard transaction: %s", reason),
|
||||||
error("AcceptToMemoryPool: nonstandard transaction: %s", reason),
|
|
||||||
REJECT_NONSTANDARD, reason);
|
REJECT_NONSTANDARD, reason);
|
||||||
|
|
||||||
// Only accept nLockTime-using transactions that can be mined in the next
|
// Only accept nLockTime-using transactions that can be mined in the next
|
||||||
@@ -1067,7 +1065,8 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
|
|||||||
if (!CheckFinalTx(tx, STANDARD_LOCKTIME_VERIFY_FLAGS))
|
if (!CheckFinalTx(tx, STANDARD_LOCKTIME_VERIFY_FLAGS))
|
||||||
return state.DoS(0, false, REJECT_NONSTANDARD, "non-final");
|
return state.DoS(0, false, REJECT_NONSTANDARD, "non-final");
|
||||||
|
|
||||||
// is it already in the memory pool?
|
fprintf(stderr,"AcceptToMemoryPool B\n");
|
||||||
|
// is it already in the memory pool?
|
||||||
uint256 hash = tx.GetHash();
|
uint256 hash = tx.GetHash();
|
||||||
if (pool.exists(hash))
|
if (pool.exists(hash))
|
||||||
{
|
{
|
||||||
@@ -1098,6 +1097,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
fprintf(stderr,"AcceptToMemoryPool C\n");
|
||||||
|
|
||||||
{
|
{
|
||||||
CCoinsView dummy;
|
CCoinsView dummy;
|
||||||
@@ -1127,6 +1127,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
fprintf(stderr,"AcceptToMemoryPool D\n");
|
||||||
|
|
||||||
// are the actual inputs available?
|
// are the actual inputs available?
|
||||||
if (!view.HaveInputs(tx))
|
if (!view.HaveInputs(tx))
|
||||||
@@ -1159,8 +1160,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
|
|||||||
unsigned int nSigOps = GetLegacySigOpCount(tx);
|
unsigned int nSigOps = GetLegacySigOpCount(tx);
|
||||||
nSigOps += GetP2SHSigOpCount(tx, view);
|
nSigOps += GetP2SHSigOpCount(tx, view);
|
||||||
if (nSigOps > MAX_STANDARD_TX_SIGOPS)
|
if (nSigOps > MAX_STANDARD_TX_SIGOPS)
|
||||||
return state.DoS(0,
|
return state.DoS(0, error("AcceptToMemoryPool: too many sigops %s, %d > %d",
|
||||||
error("AcceptToMemoryPool: too many sigops %s, %d > %d",
|
|
||||||
hash.ToString(), nSigOps, MAX_STANDARD_TX_SIGOPS),
|
hash.ToString(), nSigOps, MAX_STANDARD_TX_SIGOPS),
|
||||||
REJECT_NONSTANDARD, "bad-txns-too-many-sigops");
|
REJECT_NONSTANDARD, "bad-txns-too-many-sigops");
|
||||||
|
|
||||||
@@ -1170,6 +1170,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
|
|||||||
|
|
||||||
CTxMemPoolEntry entry(tx, nFees, GetTime(), dPriority, chainActive.Height(), mempool.HasNoInputsOf(tx));
|
CTxMemPoolEntry entry(tx, nFees, GetTime(), dPriority, chainActive.Height(), mempool.HasNoInputsOf(tx));
|
||||||
unsigned int nSize = entry.GetTxSize();
|
unsigned int nSize = entry.GetTxSize();
|
||||||
|
fprintf(stderr,"AcceptToMemoryPool D\n");
|
||||||
|
|
||||||
// Don't accept it if it can't get into a block
|
// Don't accept it if it can't get into a block
|
||||||
CAmount txMinFee = GetMinRelayFee(tx, nSize, true);
|
CAmount txMinFee = GetMinRelayFee(tx, nSize, true);
|
||||||
@@ -1201,16 +1202,15 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
|
|||||||
// -limitfreerelay unit is thousand-bytes-per-minute
|
// -limitfreerelay unit is thousand-bytes-per-minute
|
||||||
// At default rate it would take over a month to fill 1GB
|
// At default rate it would take over a month to fill 1GB
|
||||||
if (dFreeCount >= GetArg("-limitfreerelay", 15)*10*1000)
|
if (dFreeCount >= GetArg("-limitfreerelay", 15)*10*1000)
|
||||||
return state.DoS(0, error("AcceptToMemoryPool: free transaction rejected by rate limiter"),
|
return state.DoS(0, error("AcceptToMemoryPool: free transaction rejected by rate limiter"), REJECT_INSUFFICIENTFEE, "rate limited free transaction");
|
||||||
REJECT_INSUFFICIENTFEE, "rate limited free transaction");
|
|
||||||
LogPrint("mempool", "Rate limit dFreeCount: %g => %g\n", dFreeCount, dFreeCount+nSize);
|
LogPrint("mempool", "Rate limit dFreeCount: %g => %g\n", dFreeCount, dFreeCount+nSize);
|
||||||
dFreeCount += nSize;
|
dFreeCount += nSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fRejectAbsurdFee && nFees > ::minRelayTxFee.GetFee(nSize) * 10000)
|
if (fRejectAbsurdFee && nFees > ::minRelayTxFee.GetFee(nSize) * 10000)
|
||||||
return error("AcceptToMemoryPool: absurdly high fees %s, %d > %d",
|
return error("AcceptToMemoryPool: absurdly high fees %s, %d > %d",
|
||||||
hash.ToString(),
|
hash.ToString(), nFees, ::minRelayTxFee.GetFee(nSize) * 10000);
|
||||||
nFees, ::minRelayTxFee.GetFee(nSize) * 10000);
|
fprintf(stderr,"AcceptToMemoryPool E\n");
|
||||||
|
|
||||||
// Check against previous transactions
|
// Check against previous transactions
|
||||||
// This is done last to help prevent CPU exhaustion denial-of-service attacks.
|
// This is done last to help prevent CPU exhaustion denial-of-service attacks.
|
||||||
@@ -1236,6 +1236,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
|
|||||||
// Store transaction in memory
|
// Store transaction in memory
|
||||||
pool.addUnchecked(hash, entry, !IsInitialBlockDownload());
|
pool.addUnchecked(hash, entry, !IsInitialBlockDownload());
|
||||||
}
|
}
|
||||||
|
fprintf(stderr,"AcceptToMemoryPool F\n");
|
||||||
|
|
||||||
SyncWithWallets(tx, NULL);
|
SyncWithWallets(tx, NULL);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user