Changeset View
Changeset View
Standalone View
Standalone View
src/test/txvalidationcache_tests.cpp
Show All 26 Lines | BOOST_FIXTURE_TEST_CASE(tx_mempool_block_doublespend, TestChain100Setup) { | ||||
// into the memory pool does not allow double-spends in blocks to pass | // into the memory pool does not allow double-spends in blocks to pass | ||||
// validation when they should not. | // validation when they should not. | ||||
CScript scriptPubKey = CScript() << ToByteVector(coinbaseKey.GetPubKey()) | CScript scriptPubKey = CScript() << ToByteVector(coinbaseKey.GetPubKey()) | ||||
<< OP_CHECKSIG; | << OP_CHECKSIG; | ||||
const auto ToMemPool = [this](const CMutableTransaction &tx) { | const auto ToMemPool = [this](const CMutableTransaction &tx) { | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
const MempoolAcceptResult result = AcceptToMemoryPool( | const MempoolAcceptResult result = | ||||
m_node.chainman->ActiveChainstate(), GetConfig(), *m_node.mempool, | m_node.chainman->ProcessTransaction(MakeTransactionRef(tx)); | ||||
MakeTransactionRef(tx), false /* bypass_limits */); | |||||
return result.m_result_type == MempoolAcceptResult::ResultType::VALID; | return result.m_result_type == MempoolAcceptResult::ResultType::VALID; | ||||
}; | }; | ||||
// Create a double-spend of mature coinbase txn: | // Create a double-spend of mature coinbase txn: | ||||
std::vector<CMutableTransaction> spends; | std::vector<CMutableTransaction> spends; | ||||
spends.resize(2); | spends.resize(2); | ||||
for (int i = 0; i < 2; i++) { | for (int i = 0; i < 2; i++) { | ||||
spends[i].nVersion = 1; | spends[i].nVersion = 1; | ||||
▲ Show 20 Lines • Show All 649 Lines • Show Last 20 Lines |