From 40143bafb52927eb40ecfde0ea722934213eb902 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Sun, 17 Nov 2024 04:34:22 +0000 Subject: [PATCH] QA: rpc_psbt: Test that the wrong type cannot be given to named params --- test/functional/rpc_psbt.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/functional/rpc_psbt.py b/test/functional/rpc_psbt.py index f366aa6b3057b..868d50d8a1b03 100755 --- a/test/functional/rpc_psbt.py +++ b/test/functional/rpc_psbt.py @@ -950,6 +950,16 @@ def test_psbt_input_keys(psbt_input, keys): self.log.info("Test walletprocesspsbt raises if an invalid sighashtype is passed") assert_raises_rpc_error(-8, "'all' is not a valid sighash parameter.", self.nodes[0].walletprocesspsbt, psbt, sighashtype="all") + self.log.info("Test walletprocesspsbt raises RPC error with options=boolean") + for b in (True, False): + assert_raises_rpc_error(-3, "JSON value of type bool is not of expected type object", self.nodes[0].walletprocesspsbt, psbt, options=b) + + self.log.info("Test walletprocesspsbt raises RPC error with sign={options}") + assert_raises_rpc_error(-3, "JSON value of type object for field sign is not of expected type bool", self.nodes[0].walletprocesspsbt, psbt, sign={'sign': False}) + + self.log.info("Test walletprocesspsbt raises RPC help with both options and non-options sighashtype") + assert_raises_rpc_error(-1, "Arguments:", self.nodes[0].walletprocesspsbt, psbt, {'sign': False}, 'ALL') + self.log.info("Test decoding PSBT with per-input preimage types") # note that the decodepsbt RPC doesn't check whether preimages and hashes match hash_ripemd160, preimage_ripemd160 = randbytes(20), randbytes(50)