Skip to content

Commit 2b33322

Browse files
committed
Merge bitcoin/bitcoin#31249: test: Add combinerawtransaction test to rpc_createmultisig
83fab32 test: Add combinerawtransaction test to rpc_createmultisig (Ava Chow) Pull request description: The only coverage of combinerawtransaction is in a legacy wallet only test. So also use it in rpc_createmultisig so that this RPC remains tested after the legacy wallet is removed. Split from #28710 ACKs for top commit: maflcko: re-ACK 83fab32 BrandonOdiwuor: Re-ACK 83fab32 Abdulkbk: ACK 83fab32 brunoerg: code review ACK 83fab32 rkrux: tACK 83fab32 Tree-SHA512: 383d88ff6c9b54337ed81c714026e527b0fed41d976959fd5c6863b49d0defa4ea13fdc3d984885c86a2b6380825cd66c17842cc31f20fbec4bc42d86aecbbfa
2 parents 3fb6229 + 83fab32 commit 2b33322

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

test/functional/rpc_createmultisig.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -194,13 +194,19 @@ def do_multisig(self, nkeys, nsigs, output_type, wallet_multi):
194194
assert_raises_rpc_error(-8, "redeemScript/witnessScript does not match scriptPubKey", node2.signrawtransactionwithkey, rawtx, priv_keys[0:nsigs-1], [prevtx_err])
195195

196196
rawtx2 = node2.signrawtransactionwithkey(rawtx, priv_keys[0:nsigs - 1], prevtxs)
197-
rawtx3 = node2.signrawtransactionwithkey(rawtx2["hex"], [priv_keys[-1]], prevtxs)
198-
assert rawtx3['complete']
199-
200-
tx = node0.sendrawtransaction(rawtx3["hex"], 0)
197+
assert_equal(rawtx2["complete"], False)
198+
rawtx3 = node2.signrawtransactionwithkey(rawtx, [priv_keys[-1]], prevtxs)
199+
assert_equal(rawtx3["complete"], False)
200+
assert_raises_rpc_error(-22, "TX decode failed", node2.combinerawtransaction, [rawtx2['hex'], rawtx3['hex'] + "00"])
201+
assert_raises_rpc_error(-22, "Missing transactions", node2.combinerawtransaction, [])
202+
combined_rawtx = node2.combinerawtransaction([rawtx2["hex"], rawtx3["hex"]])
203+
204+
tx = node0.sendrawtransaction(combined_rawtx, 0)
201205
blk = self.generate(node0, 1)[0]
202206
assert tx in node0.getblock(blk)["tx"]
203207

208+
assert_raises_rpc_error(-25, "Input not found or already spent", node2.combinerawtransaction, [rawtx2['hex'], rawtx3['hex']])
209+
204210
# When the wallet is enabled, assert node2 sees the incoming amount
205211
if self.is_wallet_compiled():
206212
assert_equal(node2.getbalances()['mine']['trusted'], node2_balance + outval)

0 commit comments

Comments
 (0)