diff options
author | stickies-v <stickies-v@protonmail.com> | 2024-01-25 12:04:24 +0000 |
---|---|---|
committer | stickies-v <stickies-v@protonmail.com> | 2024-05-07 00:21:43 +0100 |
commit | 17f74512f0d19cb452ed79a4bff5a222fcdb53c4 (patch) | |
tree | 70c215380db4ac069a2aafc9d65e383184eda46e /test | |
parent | 7143d4388407ab3d12005e55a02d5e8f334e4dc9 (diff) |
test: add bounds checking for submitpackage RPC
Diffstat (limited to 'test')
-rwxr-xr-x | test/functional/rpc_packages.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/functional/rpc_packages.py b/test/functional/rpc_packages.py index 664f2df3f1..76a08171b5 100755 --- a/test/functional/rpc_packages.py +++ b/test/functional/rpc_packages.py @@ -25,6 +25,9 @@ from test_framework.wallet import ( ) +MAX_PACKAGE_COUNT = 25 + + class RPCPackagesTest(BitcoinTestFramework): def set_test_params(self): self.num_nodes = 1 @@ -340,6 +343,13 @@ class RPCPackagesTest(BitcoinTestFramework): assert_raises_rpc_error(-25, "package topology disallowed", node.submitpackage, chain_hex) assert_equal(legacy_pool, node.getrawmempool()) + assert_raises_rpc_error(-8, f"Array must contain between 1 and {MAX_PACKAGE_COUNT} transactions.", node.submitpackage, []) + assert_raises_rpc_error(-25, "package topology disallowed", node.submitpackage, [chain_hex[0]] * 1) + assert_raises_rpc_error( + -8, f"Array must contain between 1 and {MAX_PACKAGE_COUNT} transactions.", + node.submitpackage, [chain_hex[0]] * (MAX_PACKAGE_COUNT + 1) + ) + # Create a transaction chain such as only the parent gets accepted (by making the child's # version non-standard). Make sure the parent does get broadcast. self.log.info("If a package is partially submitted, transactions included in mempool get broadcast") |