Accept any sequence of PUSHDATAs in OP_RETURN outputs
Previously only one PUSHDATA was allowed, needlessly limiting applications such as matching OP_RETURN contents with bloom filters that operate on a per-PUSHDATA level. Now any combination that passes IsPushOnly() is allowed, so long as the total size of the scriptPubKey is less than 42 bytes. (unchanged modulo non-minimal PUSHDATA encodings) Also, this fixes the odd bug where previously the PUSHDATA could be replaced by any single opcode, even sigops consuming opcodes such as CHECKMULTISIG. (20 sigops!)
This commit is contained in:
@@ -351,12 +351,29 @@ BOOST_AUTO_TEST_CASE(test_IsStandard)
|
||||
t.vout[0].scriptPubKey = CScript() << OP_1;
|
||||
BOOST_CHECK(!IsStandardTx(t, reason));
|
||||
|
||||
// 80-byte TX_NULL_DATA (standard)
|
||||
// MAX_OP_RETURN_RELAY-byte TX_NULL_DATA (standard)
|
||||
t.vout[0].scriptPubKey = CScript() << OP_RETURN << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef3804678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38");
|
||||
BOOST_CHECK_EQUAL(MAX_OP_RETURN_RELAY, t.vout[0].scriptPubKey.size());
|
||||
BOOST_CHECK(IsStandardTx(t, reason));
|
||||
|
||||
// 81-byte TX_NULL_DATA (non-standard)
|
||||
// MAX_OP_RETURN_RELAY+1-byte TX_NULL_DATA (non-standard)
|
||||
t.vout[0].scriptPubKey = CScript() << OP_RETURN << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef3804678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef3800");
|
||||
BOOST_CHECK_EQUAL(MAX_OP_RETURN_RELAY + 1, t.vout[0].scriptPubKey.size());
|
||||
BOOST_CHECK(!IsStandardTx(t, reason));
|
||||
|
||||
// Data payload can be encoded in any way...
|
||||
t.vout[0].scriptPubKey = CScript() << OP_RETURN << ParseHex("");
|
||||
BOOST_CHECK(IsStandardTx(t, reason));
|
||||
t.vout[0].scriptPubKey = CScript() << OP_RETURN << ParseHex("00") << ParseHex("01");
|
||||
BOOST_CHECK(IsStandardTx(t, reason));
|
||||
// OP_RESERVED *is* considered to be a PUSHDATA type opcode by IsPushOnly()!
|
||||
t.vout[0].scriptPubKey = CScript() << OP_RETURN << OP_RESERVED << -1 << 0 << ParseHex("01") << 2 << 3 << 4 << 5 << 6 << 7 << 8 << 9 << 10 << 11 << 12 << 13 << 14 << 15 << 16;
|
||||
BOOST_CHECK(IsStandardTx(t, reason));
|
||||
t.vout[0].scriptPubKey = CScript() << OP_RETURN << 0 << ParseHex("01") << 2 << ParseHex("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
|
||||
BOOST_CHECK(IsStandardTx(t, reason));
|
||||
|
||||
// ...so long as it only contains PUSHDATA's
|
||||
t.vout[0].scriptPubKey = CScript() << OP_RETURN << OP_RETURN;
|
||||
BOOST_CHECK(!IsStandardTx(t, reason));
|
||||
|
||||
// TX_NULL_DATA w/o PUSHDATA
|
||||
|
||||
Reference in New Issue
Block a user