Skip to content

Commit ea756bc

Browse files
author
MarcoFalke
committed
Merge #17502: test: add unit test for non-standard bare multisig txs
1bb5d51 test: add unit test for non-standard bare multisig txs (Sebastian Falbesoner) Pull request description: Approaches another missing unit test of issue #17394: Checks that the function `IsStandardTx()` returns rejection reason `"bare-multisig"` if any one of the outputs' scriptPubKey has bare multisignature format (i.e. `M <PubKey1> <PubKey2> ... <PubKeyN> N OP_CHECKSIG`, not P2SH!) and the policy flag `fIsBareMultisigStd` is set to false. ACKs for top commit: instagibbs: utACK bitcoin/bitcoin@1bb5d51 Tree-SHA512: d7c95e35da16520d6dcd2b4278e2426fedd13f68d1f23c90e85e929774e123fbfcfbccc26df6ad1c0dd61780896fa4b4b3d4e8280c647bb06df2bfcf2ba572fb
2 parents fae9478 + 1bb5d51 commit ea756bc

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/test/transaction_tests.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,17 @@ BOOST_AUTO_TEST_CASE(test_IsStandard)
820820
reason.clear();
821821
BOOST_CHECK(!IsStandardTx(CTransaction(t), reason));
822822
BOOST_CHECK_EQUAL(reason, "scriptsig-size");
823+
824+
// Check bare multisig (standard if policy flag fIsBareMultisigStd is set)
825+
fIsBareMultisigStd = true;
826+
t.vout[0].scriptPubKey = GetScriptForMultisig(1, {key.GetPubKey()}); // simple 1-of-1
827+
t.vin[0].scriptSig = CScript() << std::vector<unsigned char>(65, 0);
828+
BOOST_CHECK(IsStandardTx(CTransaction(t), reason));
829+
830+
fIsBareMultisigStd = false;
831+
reason.clear();
832+
BOOST_CHECK(!IsStandardTx(CTransaction(t), reason));
833+
BOOST_CHECK_EQUAL(reason, "bare-multisig");
823834
}
824835

825836
BOOST_AUTO_TEST_SUITE_END()

0 commit comments

Comments
 (0)