Skip to content

Commit f883122

Browse files
committed
merge bitcoin#20562: Test that a fully signed tx given to signrawtx is unchanged
1 parent c349dad commit f883122

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/functional/rpc_signrawtransaction.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,19 @@ def script_verification_error_test(self):
121121
assert_equal(rawTxSigned['errors'][1]['txid'], inputs[2]['txid'])
122122
assert_equal(rawTxSigned['errors'][1]['vout'], inputs[2]['vout'])
123123

124+
def test_fully_signed_tx(self):
125+
self.log.info("Test signing a fully signed transaction does nothing")
126+
self.nodes[0].walletpassphrase("password", 9999)
127+
self.generate(self.nodes[0], 101)
128+
rawtx = self.nodes[0].createrawtransaction([], [{self.nodes[0].getnewaddress(): 10}])
129+
fundedtx = self.nodes[0].fundrawtransaction(rawtx)
130+
signedtx = self.nodes[0].signrawtransactionwithwallet(fundedtx["hex"])
131+
assert_equal(signedtx["complete"], True)
132+
signedtx2 = self.nodes[0].signrawtransactionwithwallet(signedtx["hex"])
133+
assert_equal(signedtx2["complete"], True)
134+
assert_equal(signedtx["hex"], signedtx2["hex"])
135+
self.nodes[0].walletlock()
136+
124137
def OP_1NEGATE_test(self):
125138
self.log.info("Test OP_1NEGATE (0x4f) satisfies BIP62 minimal push standardness rule")
126139
hex_str = (
@@ -145,6 +158,7 @@ def run_test(self):
145158
self.script_verification_error_test()
146159
self.OP_1NEGATE_test()
147160
self.test_with_lock_outputs()
161+
self.test_fully_signed_tx()
148162

149163

150164
if __name__ == '__main__':

0 commit comments

Comments
 (0)