Skip to content

Commit d7fd766

Browse files
committed
test: added test to assert TX decode rpc error on submitpackage rpc
1 parent ffe4261 commit d7fd766

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/functional/rpc_packages.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,14 @@ def test_submit_child_with_parents(self, num_parents, partial_submit):
369369
def test_submitpackage(self):
370370
node = self.nodes[0]
371371

372+
self.log.info("Submitpackage only allows valid hex inputs")
373+
valid_tx_list = self.wallet.create_self_transfer_chain(chain_length=2)
374+
hex_list = [valid_tx_list[0]["hex"][:-1] + 'X', valid_tx_list[1]["hex"]]
375+
txid_list = [valid_tx_list[0]["txid"], valid_tx_list[1]["txid"]]
376+
assert_raises_rpc_error(-22, "TX decode failed:", node.submitpackage, hex_list)
377+
assert txid_list[0] not in node.getrawmempool()
378+
assert txid_list[1] not in node.getrawmempool()
379+
372380
self.log.info("Submitpackage valid packages with 1 child and some number of parents")
373381
for num_parents in [1, 2, 24]:
374382
self.test_submit_child_with_parents(num_parents, False)

0 commit comments

Comments
 (0)