Skip to content

Commit

Permalink
test: Add combinerawtransaction test to rpc_createmultisig
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
achow101 committed Nov 8, 2024
1 parent c9e67e2 commit 83fab32
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions test/functional/rpc_createmultisig.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,13 +194,19 @@ def do_multisig(self, nkeys, nsigs, output_type, wallet_multi):
assert_raises_rpc_error(-8, "redeemScript/witnessScript does not match scriptPubKey", node2.signrawtransactionwithkey, rawtx, priv_keys[0:nsigs-1], [prevtx_err])

rawtx2 = node2.signrawtransactionwithkey(rawtx, priv_keys[0:nsigs - 1], prevtxs)
rawtx3 = node2.signrawtransactionwithkey(rawtx2["hex"], [priv_keys[-1]], prevtxs)
assert rawtx3['complete']

tx = node0.sendrawtransaction(rawtx3["hex"], 0)
assert_equal(rawtx2["complete"], False)
rawtx3 = node2.signrawtransactionwithkey(rawtx, [priv_keys[-1]], prevtxs)
assert_equal(rawtx3["complete"], False)
assert_raises_rpc_error(-22, "TX decode failed", node2.combinerawtransaction, [rawtx2['hex'], rawtx3['hex'] + "00"])
assert_raises_rpc_error(-22, "Missing transactions", node2.combinerawtransaction, [])
combined_rawtx = node2.combinerawtransaction([rawtx2["hex"], rawtx3["hex"]])

tx = node0.sendrawtransaction(combined_rawtx, 0)
blk = self.generate(node0, 1)[0]
assert tx in node0.getblock(blk)["tx"]

assert_raises_rpc_error(-25, "Input not found or already spent", node2.combinerawtransaction, [rawtx2['hex'], rawtx3['hex']])

# When the wallet is enabled, assert node2 sees the incoming amount
if self.is_wallet_compiled():
assert_equal(node2.getbalances()['mine']['trusted'], node2_balance + outval)
Expand Down

0 comments on commit 83fab32

Please sign in to comment.