Changeset View
Changeset View
Standalone View
Standalone View
src/test/txvalidationcache_tests.cpp
Show First 20 Lines • Show All 87 Lines • ▼ Show 20 Lines | BOOST_FIXTURE_TEST_CASE(tx_mempool_block_doublespend, TestChain100Setup) { | ||||
BOOST_CHECK(ToMemPool(spends[1])); | BOOST_CHECK(ToMemPool(spends[1])); | ||||
block = CreateAndProcessBlock(oneSpend, scriptPubKey); | block = CreateAndProcessBlock(oneSpend, scriptPubKey); | ||||
BOOST_CHECK(chainActive.Tip()->GetBlockHash() == block.GetHash()); | BOOST_CHECK(chainActive.Tip()->GetBlockHash() == block.GetHash()); | ||||
// spends[1] should have been removed from the mempool when the block with | // spends[1] should have been removed from the mempool when the block with | ||||
// spends[0] is accepted: | // spends[0] is accepted: | ||||
BOOST_CHECK_EQUAL(g_mempool.size(), 0U); | BOOST_CHECK_EQUAL(g_mempool.size(), 0U); | ||||
} | } | ||||
static inline bool | |||||
CheckInputs(const CTransaction &tx, CValidationState &state, | |||||
const CCoinsViewCache &view, bool fScriptChecks, | |||||
const uint32_t flags, bool sigCacheStore, bool scriptCacheStore, | |||||
const PrecomputedTransactionData &txdata, int &nSigChecksOut, | |||||
std::vector<CScriptCheck> *pvChecks, | |||||
CheckInputsLimiter *pBlockLimitSigChecks = nullptr) | |||||
EXCLUSIVE_LOCKS_REQUIRED(cs_main) { | |||||
// nSigChecksTxLimiter need to outlive this function call, because test | |||||
// cases are using pvChecks, so the verification is done asynchronously. | |||||
static TxSigCheckLimiter nSigChecksTxLimiter; | |||||
nSigChecksTxLimiter = TxSigCheckLimiter(); | |||||
return CheckInputs(tx, state, view, fScriptChecks, flags, sigCacheStore, | |||||
scriptCacheStore, txdata, nSigChecksOut, | |||||
nSigChecksTxLimiter, pBlockLimitSigChecks, pvChecks); | |||||
} | |||||
// Run CheckInputs (using pcoinsTip) on the given transaction, for all script | // Run CheckInputs (using pcoinsTip) on the given transaction, for all script | ||||
// flags. Test that CheckInputs passes for all flags that don't overlap with the | // flags. Test that CheckInputs passes for all flags that don't overlap with the | ||||
// failing_flags argument, but otherwise fails. | // failing_flags argument, but otherwise fails. | ||||
// CHECKLOCKTIMEVERIFY and CHECKSEQUENCEVERIFY (and future NOP codes that may | // CHECKLOCKTIMEVERIFY and CHECKSEQUENCEVERIFY (and future NOP codes that may | ||||
// get reassigned) have an interaction with DISCOURAGE_UPGRADABLE_NOPS: if the | // get reassigned) have an interaction with DISCOURAGE_UPGRADABLE_NOPS: if the | ||||
// script flags used contain DISCOURAGE_UPGRADABLE_NOPS but don't contain | // script flags used contain DISCOURAGE_UPGRADABLE_NOPS but don't contain | ||||
// CHECKLOCKTIMEVERIFY (or CHECKSEQUENCEVERIFY), but the script does contain | // CHECKLOCKTIMEVERIFY (or CHECKSEQUENCEVERIFY), but the script does contain | ||||
// OP_CHECKLOCKTIMEVERIFY (or OP_CHECKSEQUENCEVERIFY), then script execution | // OP_CHECKLOCKTIMEVERIFY (or OP_CHECKSEQUENCEVERIFY), then script execution | ||||
▲ Show 20 Lines • Show All 539 Lines • Show Last 20 Lines |