Changeset View
Changeset View
Standalone View
Standalone View
src/test/txvalidation_tests.cpp
Show All 35 Lines | BOOST_FIXTURE_TEST_CASE(tx_mempool_reject_coinbase, TestChain100Setup) { | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
unsigned int initialPoolSize = m_node.mempool->size(); | unsigned int initialPoolSize = m_node.mempool->size(); | ||||
BOOST_CHECK_EQUAL(false, | BOOST_CHECK_EQUAL(false, | ||||
AcceptToMemoryPool(GetConfig(), *m_node.mempool, state, | AcceptToMemoryPool(GetConfig(), *m_node.mempool, state, | ||||
MakeTransactionRef(coinbaseTx), | MakeTransactionRef(coinbaseTx), | ||||
nullptr /* pfMissingInputs */, | |||||
true /* bypass_limits */, | true /* bypass_limits */, | ||||
Amount::zero() /* nAbsurdFee */)); | Amount::zero() /* nAbsurdFee */)); | ||||
// Check that the transaction hasn't been added to mempool. | // Check that the transaction hasn't been added to mempool. | ||||
BOOST_CHECK_EQUAL(m_node.mempool->size(), initialPoolSize); | BOOST_CHECK_EQUAL(m_node.mempool->size(), initialPoolSize); | ||||
// Check that the validation state reflects the unsuccesful attempt. | // Check that the validation state reflects the unsuccesful attempt. | ||||
BOOST_CHECK(state.IsInvalid()); | BOOST_CHECK(state.IsInvalid()); | ||||
BOOST_CHECK_EQUAL(state.GetRejectReason(), "bad-tx-coinbase"); | BOOST_CHECK_EQUAL(state.GetRejectReason(), "bad-tx-coinbase"); | ||||
BOOST_CHECK(state.GetReason() == ValidationInvalidReason::CONSENSUS); | BOOST_CHECK(state.GetReason() == ValidationInvalidReason::CONSENSUS); | ||||
} | } | ||||
BOOST_AUTO_TEST_SUITE_END() | BOOST_AUTO_TEST_SUITE_END() |