diff --git a/src/test/script_P2SH_tests.cpp b/src/test/script_P2SH_tests.cpp --- a/src/test/script_P2SH_tests.cpp +++ b/src/test/script_P2SH_tests.cpp @@ -75,7 +75,8 @@ evalScripts[i] = GetScriptForDestination(CScriptID(standardScripts[i])); } - CMutableTransaction txFrom; // Funding transaction: + // Funding transaction: + CMutableTransaction txFrom; std::string reason; txFrom.vout.resize(8); for (int i = 0; i < 4; i++) { @@ -86,7 +87,8 @@ } BOOST_CHECK(IsStandardTx(CTransaction(txFrom), reason)); - CMutableTransaction txTo[8]; // Spending transactions + // Spending transactions + CMutableTransaction txTo[8]; for (int i = 0; i < 8; i++) { txTo[i].vin.resize(1); txTo[i].vout.resize(1); @@ -95,12 +97,14 @@ BOOST_CHECK_MESSAGE(IsMine(keystore, txFrom.vout[i].scriptPubKey), strprintf("IsMine %d", i)); } + for (int i = 0; i < 8; i++) { BOOST_CHECK_MESSAGE(SignSignature(keystore, CTransaction(txFrom), txTo[i], 0, SigHashType().withForkId()), strprintf("SignSignature %d", i)); } + // All of the above should be OK, and the txTos have valid signatures // Check to make sure signature verification fails if we use the wrong // ScriptSig: diff --git a/src/test/sigopcount_tests.cpp b/src/test/sigopcount_tests.cpp --- a/src/test/sigopcount_tests.cpp +++ b/src/test/sigopcount_tests.cpp @@ -75,7 +75,7 @@ bool ret = VerifyScript( inputi.vin[0].scriptSig, output.vout[0].scriptPubKey, flags, TransactionSignatureChecker(&inputi, 0, output.vout[0].nValue), &error); - BOOST_CHECK((ret == true) == (error == SCRIPT_ERR_OK)); + BOOST_CHECK_EQUAL((ret == true), (error == SCRIPT_ERR_OK)); return error; } @@ -138,16 +138,19 @@ // scriptPubKeys of a transaction and does not take the actual executed // sig operations into account. spendingTx in itself does not contain a // signature operation. - assert(GetTransactionSigOpCount(CTransaction(spendingTx), coins, - flags) == 0); + BOOST_CHECK_EQUAL( + GetTransactionSigOpCount(CTransaction(spendingTx), coins, flags), + 0); // creationTx contains two signature operations in its scriptPubKey, but // legacy counting is not accurate. - assert(GetTransactionSigOpCount(CTransaction(creationTx), coins, - flags) == MAX_PUBKEYS_PER_MULTISIG); + BOOST_CHECK_EQUAL( + GetTransactionSigOpCount(CTransaction(creationTx), coins, flags), + MAX_PUBKEYS_PER_MULTISIG); // Sanity check: script verification fails because of an invalid // signature. - assert(VerifyWithFlag(CTransaction(creationTx), spendingTx, flags) == - SCRIPT_ERR_CHECKMULTISIGVERIFY); + BOOST_CHECK_EQUAL( + VerifyWithFlag(CTransaction(creationTx), spendingTx, flags), + SCRIPT_ERR_CHECKMULTISIGVERIFY); } // Multisig nested in P2SH @@ -160,10 +163,12 @@ << OP_0 << OP_0 << ToByteVector(redeemScript); BuildTxs(spendingTx, coins, creationTx, scriptPubKey, scriptSig); - assert(GetTransactionSigOpCount(CTransaction(spendingTx), coins, - flags) == 2); - assert(VerifyWithFlag(CTransaction(creationTx), spendingTx, flags) == - SCRIPT_ERR_CHECKMULTISIGVERIFY); + BOOST_CHECK_EQUAL( + GetTransactionSigOpCount(CTransaction(spendingTx), coins, flags), + 2); + BOOST_CHECK_EQUAL( + VerifyWithFlag(CTransaction(creationTx), spendingTx, flags), + SCRIPT_ERR_CHECKMULTISIGVERIFY); } }