Skip to content

Commit 6dbfe08

Browse files
committed
[qa] test signrawtransaction merge with missing inputs
1 parent ec4f7e4 commit 6dbfe08

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

qa/rpc-tests/signrawtransactions.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,22 @@ def successful_signing_test(self):
4848
# 2) No script verification error occurred
4949
assert 'errors' not in rawTxSigned
5050

51+
# Check that signrawtransaction doesn't blow up on garbage merge attempts
52+
dummyTxInconsistent = self.nodes[0].createrawtransaction([inputs[0]], outputs)
53+
rawTxUnsigned = self.nodes[0].signrawtransaction(rawTx + dummyTxInconsistent, inputs)
54+
55+
assert 'complete' in rawTxUnsigned
56+
assert_equal(rawTxUnsigned['complete'], False)
57+
58+
# Check that signrawtransaction properly merges unsigned and signed txn, even with garbage in the middle
59+
rawTxSigned2 = self.nodes[0].signrawtransaction(rawTxUnsigned["hex"] + dummyTxInconsistent + rawTxSigned["hex"], inputs)
60+
61+
assert 'complete' in rawTxSigned2
62+
assert_equal(rawTxSigned2['complete'], True)
63+
64+
assert 'errors' not in rawTxSigned2
65+
66+
5167
def script_verification_error_test(self):
5268
"""Creates and signs a raw transaction with valid (vin 0), invalid (vin 1) and one missing (vin 2) input script.
5369

0 commit comments

Comments
 (0)