Changeset View
Changeset View
Standalone View
Standalone View
src/test/txvalidationcache_tests.cpp
Show All 17 Lines | |||||
#include "txmempool.h" | #include "txmempool.h" | ||||
#include "utiltime.h" | #include "utiltime.h" | ||||
#include "validation.h" | #include "validation.h" | ||||
#include <boost/test/unit_test.hpp> | #include <boost/test/unit_test.hpp> | ||||
BOOST_AUTO_TEST_SUITE(txvalidationcache_tests) | BOOST_AUTO_TEST_SUITE(txvalidationcache_tests) | ||||
static bool ToMemPool(CMutableTransaction &tx) { | static bool ToMemPool(const CMutableTransaction &tx) { | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
CValidationState state; | CValidationState state; | ||||
return AcceptToMemoryPool(GetConfig(), mempool, state, | return AcceptToMemoryPool(GetConfig(), mempool, state, | ||||
MakeTransactionRef(tx), false, nullptr, true, | MakeTransactionRef(tx), false, nullptr, true, | ||||
Amount::zero()); | Amount::zero()); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 165 Lines • ▼ Show 20 Lines | BOOST_FIXTURE_TEST_CASE(checkinputs_test, TestChain100Setup) { | ||||
const CTransaction spend_tx(mutableSpend_tx); | const CTransaction spend_tx(mutableSpend_tx); | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
// Test that invalidity under a set of flags doesn't preclude validity under | // Test that invalidity under a set of flags doesn't preclude validity under | ||||
// other (eg consensus) flags. | // other (eg consensus) flags. | ||||
// spend_tx is invalid according to DERSIG | // spend_tx is invalid according to DERSIG | ||||
CValidationState state; | |||||
{ | { | ||||
CValidationState state; | |||||
PrecomputedTransactionData ptd_spend_tx(spend_tx); | PrecomputedTransactionData ptd_spend_tx(spend_tx); | ||||
BOOST_CHECK(!CheckInputs(spend_tx, state, pcoinsTip, true, | BOOST_CHECK(!CheckInputs(spend_tx, state, pcoinsTip, true, | ||||
MANDATORY_SCRIPT_VERIFY_FLAGS | | MANDATORY_SCRIPT_VERIFY_FLAGS | | ||||
SCRIPT_VERIFY_CLEANSTACK, | SCRIPT_VERIFY_CLEANSTACK, | ||||
true, true, ptd_spend_tx, nullptr)); | true, true, ptd_spend_tx, nullptr)); | ||||
// If we call again asking for scriptchecks (as happens in | // If we call again asking for scriptchecks (as happens in | ||||
▲ Show 20 Lines • Show All 175 Lines • Show Last 20 Lines |