mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 06:28:31 +01:00
Pass datacarrier setting into IsStandard
This commit is contained in:
@@ -141,23 +141,30 @@ BOOST_AUTO_TEST_CASE(multisig_IsStandard)
|
||||
for (int i = 0; i < 4; i++)
|
||||
key[i].MakeNewKey(true);
|
||||
|
||||
TxoutType whichType;
|
||||
const auto is_standard{[](const CScript& spk) {
|
||||
TxoutType type;
|
||||
bool res{::IsStandard(spk, std::nullopt, type)};
|
||||
if (res) {
|
||||
BOOST_CHECK_EQUAL(type, TxoutType::MULTISIG);
|
||||
}
|
||||
return res;
|
||||
}};
|
||||
|
||||
CScript a_and_b;
|
||||
a_and_b << OP_2 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << OP_2 << OP_CHECKMULTISIG;
|
||||
BOOST_CHECK(::IsStandard(a_and_b, whichType));
|
||||
BOOST_CHECK(is_standard(a_and_b));
|
||||
|
||||
CScript a_or_b;
|
||||
a_or_b << OP_1 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << OP_2 << OP_CHECKMULTISIG;
|
||||
BOOST_CHECK(::IsStandard(a_or_b, whichType));
|
||||
BOOST_CHECK(is_standard(a_or_b));
|
||||
|
||||
CScript escrow;
|
||||
escrow << OP_2 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << ToByteVector(key[2].GetPubKey()) << OP_3 << OP_CHECKMULTISIG;
|
||||
BOOST_CHECK(::IsStandard(escrow, whichType));
|
||||
BOOST_CHECK(is_standard(escrow));
|
||||
|
||||
CScript one_of_four;
|
||||
one_of_four << OP_1 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << ToByteVector(key[2].GetPubKey()) << ToByteVector(key[3].GetPubKey()) << OP_4 << OP_CHECKMULTISIG;
|
||||
BOOST_CHECK(!::IsStandard(one_of_four, whichType));
|
||||
BOOST_CHECK(!is_standard(one_of_four));
|
||||
|
||||
CScript malformed[6];
|
||||
malformed[0] << OP_3 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << OP_2 << OP_CHECKMULTISIG;
|
||||
@@ -167,8 +174,9 @@ BOOST_AUTO_TEST_CASE(multisig_IsStandard)
|
||||
malformed[4] << OP_1 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << OP_CHECKMULTISIG;
|
||||
malformed[5] << OP_1 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey());
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
BOOST_CHECK(!::IsStandard(malformed[i], whichType));
|
||||
for (int i = 0; i < 6; i++) {
|
||||
BOOST_CHECK(!is_standard(malformed[i]));
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(multisig_Sign)
|
||||
|
||||
Reference in New Issue
Block a user