aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Corallo <[email protected]>2017-02-02 16:24:52 -0500
committerMatt Corallo <[email protected]>2017-02-02 17:40:49 -0500
commit6dbfe08c29535bb7b0359de8fe22acedcbf3532a (patch)
tree578be411a76bd269454aac797efe135d7e376cda
parent[qa] Add second input to signrawtransaction test case (diff)
downloaddiscoin-6dbfe08c29535bb7b0359de8fe22acedcbf3532a.tar.xz
discoin-6dbfe08c29535bb7b0359de8fe22acedcbf3532a.zip
[qa] test signrawtransaction merge with missing inputs
-rwxr-xr-xqa/rpc-tests/signrawtransactions.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/qa/rpc-tests/signrawtransactions.py b/qa/rpc-tests/signrawtransactions.py
index 1705ab96c..109312bd5 100755
--- a/qa/rpc-tests/signrawtransactions.py
+++ b/qa/rpc-tests/signrawtransactions.py
@@ -48,6 +48,22 @@ class SignRawTransactionsTest(BitcoinTestFramework):
# 2) No script verification error occurred
assert 'errors' not in rawTxSigned
+ # Check that signrawtransaction doesn't blow up on garbage merge attempts
+ dummyTxInconsistent = self.nodes[0].createrawtransaction([inputs[0]], outputs)
+ rawTxUnsigned = self.nodes[0].signrawtransaction(rawTx + dummyTxInconsistent, inputs)
+
+ assert 'complete' in rawTxUnsigned
+ assert_equal(rawTxUnsigned['complete'], False)
+
+ # Check that signrawtransaction properly merges unsigned and signed txn, even with garbage in the middle
+ rawTxSigned2 = self.nodes[0].signrawtransaction(rawTxUnsigned["hex"] + dummyTxInconsistent + rawTxSigned["hex"], inputs)
+
+ assert 'complete' in rawTxSigned2
+ assert_equal(rawTxSigned2['complete'], True)
+
+ assert 'errors' not in rawTxSigned2
+
+
def script_verification_error_test(self):
"""Creates and signs a raw transaction with valid (vin 0), invalid (vin 1) and one missing (vin 2) input script.