Skip to content

Commit 773c42b

Browse files
committed
tests: Test that a fully signed tx given to signrawtx is unchanged
Tests that a fully signed transaction given to signrawtransactionwithwallet is both unchanged and marked as complete. This tests for a regression in 0.20 where the transaction would not be marked as complete.
1 parent a0489f3 commit 773c42b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/functional/rpc_signrawtransaction.py

+14
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,19 @@ def script_verification_error_test(self):
151151
assert_equal(rawTxSigned['errors'][1]['witness'], ["304402203609e17b84f6a7d30c80bfa610b5b4542f32a8a0d5447a12fb1366d7f01cc44a0220573a954c4518331561406f90300e8f3358f51928d43c212a8caed02de67eebee01", "025476c2e83188368da1ff3e292e7acafcdb3566bb0ad253f62fc70f07aeee6357"])
152152
assert not rawTxSigned['errors'][0]['witness']
153153

154+
def test_fully_signed_tx(self):
155+
self.log.info("Test signing a fully signed transaction does nothing")
156+
self.nodes[0].walletpassphrase("password", 9999)
157+
self.nodes[0].generate(101)
158+
rawtx = self.nodes[0].createrawtransaction([], [{self.nodes[0].getnewaddress(): 10}])
159+
fundedtx = self.nodes[0].fundrawtransaction(rawtx)
160+
signedtx = self.nodes[0].signrawtransactionwithwallet(fundedtx["hex"])
161+
assert_equal(signedtx["complete"], True)
162+
signedtx2 = self.nodes[0].signrawtransactionwithwallet(signedtx["hex"])
163+
assert_equal(signedtx2["complete"], True)
164+
assert_equal(signedtx["hex"], signedtx2["hex"])
165+
self.nodes[0].walletlock()
166+
154167
def witness_script_test(self):
155168
self.log.info("Test signing transaction to P2SH-P2WSH addresses without wallet")
156169
# Create a new P2SH-P2WSH 1-of-1 multisig address:
@@ -231,6 +244,7 @@ def run_test(self):
231244
self.witness_script_test()
232245
self.OP_1NEGATE_test()
233246
self.test_with_lock_outputs()
247+
self.test_fully_signed_tx()
234248

235249

236250
if __name__ == '__main__':

0 commit comments

Comments
 (0)