mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-17 13:07:54 +02:00
test: add unit test for non-standard txs with too large scriptSig
The function IsStandardTx() returns rejection reason "scriptsig-size" if any one the inputs' scriptSig is larger than 1650 bytes.
This commit is contained in:
parent
cd6cb9745e
commit
5e8a56348b
1 changed files with 13 additions and 0 deletions
|
|
@ -784,6 +784,19 @@ BOOST_AUTO_TEST_CASE(test_IsStandard)
|
||||||
reason.clear();
|
reason.clear();
|
||||||
BOOST_CHECK(!IsStandardTx(CTransaction(t), reason));
|
BOOST_CHECK(!IsStandardTx(CTransaction(t), reason));
|
||||||
BOOST_CHECK_EQUAL(reason, "multi-op-return");
|
BOOST_CHECK_EQUAL(reason, "multi-op-return");
|
||||||
|
|
||||||
|
// Check large scriptSig (non-standard if size is >1650 bytes)
|
||||||
|
t.vout.resize(1);
|
||||||
|
t.vout[0].nValue = MAX_MONEY;
|
||||||
|
t.vout[0].scriptPubKey = GetScriptForDestination(PKHash(key.GetPubKey()));
|
||||||
|
// OP_PUSHDATA2 with len (3 bytes) + data (1647 bytes) = 1650 bytes
|
||||||
|
t.vin[0].scriptSig = CScript() << std::vector<unsigned char>(1647, 0); // 1650
|
||||||
|
BOOST_CHECK(IsStandardTx(CTransaction(t), reason));
|
||||||
|
|
||||||
|
t.vin[0].scriptSig = CScript() << std::vector<unsigned char>(1648, 0); // 1651
|
||||||
|
reason.clear();
|
||||||
|
BOOST_CHECK(!IsStandardTx(CTransaction(t), reason));
|
||||||
|
BOOST_CHECK_EQUAL(reason, "scriptsig-size");
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE_END()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue