aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2019-11-15 14:03:54 -0500
committerMarcoFalke <falke.marco@gmail.com>2019-11-15 14:03:56 -0500
commitf92e750eb4eb275b30940a149568e094f0f9523d (patch)
tree74408007a2d8b430d90c5d83f11eec969c93e4b2
parent422ec33d45ed1ab90031a587b34005c16c1a8796 (diff)
parent5e8a56348b5e1026e9ddcae0b2fa2a68faf4439e (diff)
Merge #17480: test: add unit test for non-standard txs with too large scriptSig
5e8a56348b5e1026e9ddcae0b2fa2a68faf4439e test: add unit test for non-standard txs with too large scriptSig (Sebastian Falbesoner) Pull request description: Approaches the first missing test of issue #17394: Checks that the function `IsStandardTx()` returns rejection reason `"scriptsig-size"` if any one the inputs' scriptSig is larger than 1650 bytes. ACKs for top commit: MarcoFalke: ACK 5e8a56348b5e1026e9ddcae0b2fa2a68faf4439e instagibbs: ACK https://github.com/bitcoin/bitcoin/commit/5e8a56348b5e1026e9ddcae0b2fa2a68faf4439e Tree-SHA512: 79977b12ddea9438a37cefdbb48cc551e4ad02a8ccfaa2d2837ced9f3a185e2e07cc366c243b9e3c7736245e90e315d7b4110efc6b440c63dbef7ee2c9d78a73
-rw-r--r--src/test/transaction_tests.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/test/transaction_tests.cpp b/src/test/transaction_tests.cpp
index 2d55554acb..eb0050a4a3 100644
--- a/src/test/transaction_tests.cpp
+++ b/src/test/transaction_tests.cpp
@@ -784,6 +784,19 @@ BOOST_AUTO_TEST_CASE(test_IsStandard)
reason.clear();
BOOST_CHECK(!IsStandardTx(CTransaction(t), reason));
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()