mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-19 01:42:58 +01:00
Merge bitcoin/bitcoin#31249: test: Add combinerawtransaction test to rpc_createmultisig
83fab3212c
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-ACK83fab3212c
BrandonOdiwuor: Re-ACK83fab3212c
Abdulkbk: ACK83fab3212c
brunoerg: code review ACK83fab3212c
rkrux: tACK83fab3212c
Tree-SHA512: 383d88ff6c9b54337ed81c714026e527b0fed41d976959fd5c6863b49d0defa4ea13fdc3d984885c86a2b6380825cd66c17842cc31f20fbec4bc42d86aecbbfa
This commit is contained in:
commit
2b33322169
@ -194,13 +194,19 @@ class RpcCreateMultiSigTest(BitcoinTestFramework):
|
|||||||
assert_raises_rpc_error(-8, "redeemScript/witnessScript does not match scriptPubKey", node2.signrawtransactionwithkey, rawtx, priv_keys[0:nsigs-1], [prevtx_err])
|
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)
|
rawtx2 = node2.signrawtransactionwithkey(rawtx, priv_keys[0:nsigs - 1], prevtxs)
|
||||||
rawtx3 = node2.signrawtransactionwithkey(rawtx2["hex"], [priv_keys[-1]], prevtxs)
|
assert_equal(rawtx2["complete"], False)
|
||||||
assert rawtx3['complete']
|
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(rawtx3["hex"], 0)
|
tx = node0.sendrawtransaction(combined_rawtx, 0)
|
||||||
blk = self.generate(node0, 1)[0]
|
blk = self.generate(node0, 1)[0]
|
||||||
assert tx in node0.getblock(blk)["tx"]
|
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
|
# When the wallet is enabled, assert node2 sees the incoming amount
|
||||||
if self.is_wallet_compiled():
|
if self.is_wallet_compiled():
|
||||||
assert_equal(node2.getbalances()['mine']['trusted'], node2_balance + outval)
|
assert_equal(node2.getbalances()['mine']['trusted'], node2_balance + outval)
|
||||||
|
Loading…
Reference in New Issue
Block a user