Skip to content

Commit f1bcf3e

Browse files
committed
Merge bitcoin/bitcoin#31139: test: added test to assert TX decode rpc error on submitpackage rpc
d7fd766 test: added test to assert TX decode rpc error on submitpackage rpc (kevkevinpal) Pull request description: This PR adds coverage for this line https://github.com/bitcoin/bitcoin/blob/master/src/rpc/mempool.cpp#L996 If you run the following you will get no results for `submitpackage` `grep -nri "TX decode failed" ./test/functional` ACKs for top commit: achow101: ACK d7fd766 instagibbs: reACK bitcoin/bitcoin@d7fd766 tdb3: ACK d7fd766 rkrux: reACK d7fd766 Tree-SHA512: e92e0e2621a4efab35625d8da3ac61ccb7fa65c378aa977112bc132fd3b42431f8c3ceb081f7c9903ed2833c229042b65bdb11444e1d6367354ae65dc7504231
2 parents 975b115 + d7fd766 commit f1bcf3e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/functional/rpc_packages.py

+8
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)