Skip to content

Commit a56e9f5

Browse files
committed
test: Assert exclusive PSBT funding options
Make sure the options "change_type" and "changeAddress" of the walletcreatefundedpsbt RPC cannot both be specified a the same time.
1 parent 64bc5ef commit a56e9f5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

test/functional/rpc_psbt.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,10 @@ def run_test(self):
320320
psbtx_np2wkh = self.nodes[1].walletcreatefundedpsbt([], [small_output], 0, {"change_type":"p2sh-segwit"})
321321
self.assert_change_type(psbtx_np2wkh, "scripthash")
322322

323+
# Make sure the change type cannot be specified if a change address is given
324+
invalid_options = {"change_type":"legacy","changeAddress":self.nodes[0].getnewaddress()}
325+
assert_raises_rpc_error(-8, "both change address and address type options", self.nodes[0].walletcreatefundedpsbt, [], [small_output], 0, invalid_options)
326+
323327
# Regression test for 14473 (mishandling of already-signed witness transaction):
324328
psbtx_info = self.nodes[0].walletcreatefundedpsbt([{"txid":unspent["txid"], "vout":unspent["vout"]}], [{self.nodes[2].getnewaddress():unspent["amount"]+1}], 0, {"add_inputs": True})
325329
complete_psbt = self.nodes[0].walletprocesspsbt(psbtx_info["psbt"])

0 commit comments

Comments
 (0)