
Neither the unit nor functional tests appear to cover rejecting a transaction from acceptance to the mempool on the basis of it being a coinbase. Seems like a decent thing to have a test for.

Neither the unit nor functional tests appear to cover rejecting a transaction from acceptance to the mempool on the basis of it being a coinbase. Seems like a decent thing to have a test for.
Concept ACK
utACK, thanks for adding test coverage
52 | + // Check that the validation state reflects the unsuccesful attempt. 53 | + BOOST_CHECK(state.IsInvalid()); 54 | + BOOST_CHECK_EQUAL(state.GetRejectReason(), "coinbase"); 55 | + 56 | + int nDoS; 57 | + BOOST_CHECK_EQUAL(state.IsInvalid(nDoS), true);
Call this above:
int nDoS;
BOOST_CHECK(state.IsInvalid(nDoS), true);
BOOST_CHECK_EQUAL(nDoS, 100);
BOOST_CHECK_EQUAL(state.GetRejectReason(), "coinbase");
@MarcoFalke any reason to not consider the suggestion?
@promag was happy to make the change but didn't have time yet, though it's worth noting that I'm uncertain on what the real difference would be aside from cosmetics. Note that state.IsInvalid with and without an argument call to separate methods, so why not get coverage on both?
To me this seems mostly a cosmetic nit, subject to personal preference of style. For test related pulls I don't see a reason to block them solely based on style nits.
18 | +/** 19 | + * Ensure that the mempool won't accept coinbase transactions. 20 | + */ 21 | +BOOST_FIXTURE_TEST_CASE(tx_mempool_reject_coinbase, TestChain100Setup) 22 | +{ 23 | + CScript scriptPubKey = CScript() << ToByteVector(coinbaseKey.GetPubKey()) << OP_CHECKSIG;
Nit, inline below?
19 | + * Ensure that the mempool won't accept coinbase transactions. 20 | + */ 21 | +BOOST_FIXTURE_TEST_CASE(tx_mempool_reject_coinbase, TestChain100Setup) 22 | +{ 23 | + CScript scriptPubKey = CScript() << ToByteVector(coinbaseKey.GetPubKey()) << OP_CHECKSIG; 24 | + CMutableTransaction coinbaseTx;
Nit, just tx.
utACK 65e91f5.
utACK 65e91f5edf555691d0e5809d441cff7fa63ba722
28 | + coinbaseTx.vout.resize(1); 29 | + coinbaseTx.vin[0].scriptSig = CScript() << OP_11 << OP_EQUAL; 30 | + coinbaseTx.vout[0].nValue = 1 * CENT; 31 | + coinbaseTx.vout[0].scriptPubKey = scriptPubKey; 32 | + 33 | + assert(CTransaction(coinbaseTx).IsCoinBase());
nit: In the future use BOOST_REQUIRE?