Merge bitcoin/bitcoin#32850: test: check P2SH sigop count for coinbase tx

d6aaffcb11adcf47480fcc5081af9dcb732decf3 test: check P2SH sigop count for coinbase tx (brunoerg)

Pull request description:

  We currently do not test that `GetP2SHSigOpCount` returns 0 for coinbase transactions (see line L129 at https://corecheck.dev/mutation/src/consensus/tx_verify.cpp). This PR addresses it.

ACKs for top commit:
  darosior:
    That said, i guess unit-tested dead consensus code is better than not-unit-tested dead consensus code. utACK d6aaffcb11adcf47480fcc5081af9dcb732decf3
  theStack:
    ACK d6aaffcb11adcf47480fcc5081af9dcb732decf3
  w0xlt:
    ACK d6aaffcb11
  ishaanam:
    ACK d6aaffcb11adcf47480fcc5081af9dcb732decf3
  pablomartin4btc:
    ACK d6aaffcb11adcf47480fcc5081af9dcb732decf3

Tree-SHA512: a7d7306f064bb2ec7e93e92625848ae38e150ebb67bde37cd15be1038816b154e867ad21ecd2685d8de5341b67e3b768d30b7654e27b541f33e8f9d63e52261d
This commit is contained in:
merge-script 2025-07-03 09:46:53 +01:00
commit 49d5f1f2c6
No known key found for this signature in database
GPG Key ID: 2EEB9F5CC09526C1

View File

@ -364,6 +364,12 @@ BOOST_AUTO_TEST_CASE(AreInputsStandard)
// 22 P2SH sigops for all inputs (1 for vin[0], 6 for vin[3], 15 for vin[4]
BOOST_CHECK_EQUAL(GetP2SHSigOpCount(CTransaction(txTo), coins), 22U);
CMutableTransaction coinbase_tx_mut;
coinbase_tx_mut.vin.resize(1);
CTransaction coinbase_tx{coinbase_tx_mut};
BOOST_CHECK(coinbase_tx.IsCoinBase());
BOOST_CHECK_EQUAL(GetP2SHSigOpCount(coinbase_tx, coins), 0U);
CMutableTransaction txToNonStd1;
txToNonStd1.vout.resize(1);
txToNonStd1.vout[0].scriptPubKey = GetScriptForDestination(PKHash(key[1].GetPubKey()));