diff options
author | brunoerg <brunoely.gc@gmail.com> | 2024-06-12 11:11:32 -0300 |
---|---|---|
committer | brunoerg <brunoely.gc@gmail.com> | 2024-06-12 17:07:16 -0300 |
commit | e2779ce98b39e14cada08a654928e798436f5a46 (patch) | |
tree | 507b6549e3b82e3b6a2a6c05b7437acd27e61869 /test/functional | |
parent | a7bc9b76e73f04dfe4d6ba42033fe38659090e8b (diff) |
test: cover more errors for `signrawtransactionwithkey` RPC
* Invalid private key
* TX decode failed
Diffstat (limited to 'test/functional')
-rwxr-xr-x | test/functional/rpc_signrawtransactionwithkey.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/functional/rpc_signrawtransactionwithkey.py b/test/functional/rpc_signrawtransactionwithkey.py index 268584331e..f4fec13495 100755 --- a/test/functional/rpc_signrawtransactionwithkey.py +++ b/test/functional/rpc_signrawtransactionwithkey.py @@ -126,10 +126,20 @@ class SignRawTransactionWithKeyTest(BitcoinTestFramework): privkeys = [self.nodes[0].get_deterministic_priv_key().key] assert_raises_rpc_error(-8, "'all' is not a valid sighash parameter.", self.nodes[0].signrawtransactionwithkey, tx, privkeys, sighashtype="all") + def invalid_private_key_and_tx(self): + self.log.info("Test signing transaction with an invalid private key") + tx = self.nodes[0].createrawtransaction(INPUTS, OUTPUTS) + privkeys = ["123"] + assert_raises_rpc_error(-5, "Invalid private key", self.nodes[0].signrawtransactionwithkey, tx, privkeys) + self.log.info("Test signing transaction with an invalid tx hex") + privkeys = [self.nodes[0].get_deterministic_priv_key().key] + assert_raises_rpc_error(-22, "TX decode failed. Make sure the tx has at least one input.", self.nodes[0].signrawtransactionwithkey, tx + "00", privkeys) + def run_test(self): self.successful_signing_test() self.witness_script_test() self.invalid_sighashtype_test() + self.invalid_private_key_and_tx() if __name__ == '__main__': |