aboutsummaryrefslogtreecommitdiff
path: root/test/functional/wallet_signrawtransactionwithwallet.py
diff options
context:
space:
mode:
authorJon Atack <jon@atack.com>2023-07-26 16:56:48 -0600
committerJon Atack <jon@atack.com>2023-07-27 06:37:54 -0600
commit647d95aae9720543c2c9c46c70191e6f9f775d66 (patch)
treea421c35f532dc9cdf595fe7302cf7d5b9a488ae0 /test/functional/wallet_signrawtransactionwithwallet.py
parentf57e724a809feb139c5ae71c4db65635427e4802 (diff)
downloadbitcoin-647d95aae9720543c2c9c46c70191e6f9f775d66.tar.xz
test: add coverage for passing an invalid sighashtype
in RPCs descriptorprocesspbst, walletprocesspbst, signrawtransactionwithkey, and signrawtransactionwithwallet.
Diffstat (limited to 'test/functional/wallet_signrawtransactionwithwallet.py')
-rwxr-xr-xtest/functional/wallet_signrawtransactionwithwallet.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/test/functional/wallet_signrawtransactionwithwallet.py b/test/functional/wallet_signrawtransactionwithwallet.py
index 3d2f41cb83..d560dfdc11 100755
--- a/test/functional/wallet_signrawtransactionwithwallet.py
+++ b/test/functional/wallet_signrawtransactionwithwallet.py
@@ -33,6 +33,10 @@ from decimal import (
getcontext,
)
+
+RAW_TX = '020000000156b958f78e3f24e0b2f4e4db1255426b0902027cb37e3ddadb52e37c3557dddb0000000000ffffffff01c0a6b929010000001600149a2ee8c77140a053f36018ac8124a6ececc1668a00000000'
+
+
class SignRawTransactionWithWalletTest(BitcoinTestFramework):
def add_options(self, parser):
self.add_wallet_options(parser)
@@ -47,10 +51,12 @@ class SignRawTransactionWithWalletTest(BitcoinTestFramework):
def test_with_lock_outputs(self):
self.log.info("Test correct error reporting when trying to sign a locked output")
self.nodes[0].encryptwallet("password")
+ assert_raises_rpc_error(-13, "Please enter the wallet passphrase with walletpassphrase first", self.nodes[0].signrawtransactionwithwallet, RAW_TX)
+ self.nodes[0].walletpassphrase("password", 9999)
- rawTx = '020000000156b958f78e3f24e0b2f4e4db1255426b0902027cb37e3ddadb52e37c3557dddb0000000000ffffffff01c0a6b929010000001600149a2ee8c77140a053f36018ac8124a6ececc1668a00000000'
-
- assert_raises_rpc_error(-13, "Please enter the wallet passphrase with walletpassphrase first", self.nodes[0].signrawtransactionwithwallet, rawTx)
+ def test_with_invalid_sighashtype(self):
+ self.log.info("Test signrawtransactionwithwallet raises if an invalid sighashtype is passed")
+ assert_raises_rpc_error(-8, "all is not a valid sighash parameter.", self.nodes[0].signrawtransactionwithwallet, hexstring=RAW_TX, sighashtype="all")
def script_verification_error_test(self):
"""Create and sign a raw transaction with valid (vin 0), invalid (vin 1) and one missing (vin 2) input script.
@@ -299,6 +305,7 @@ class SignRawTransactionWithWalletTest(BitcoinTestFramework):
self.script_verification_error_test()
self.OP_1NEGATE_test()
self.test_with_lock_outputs()
+ self.test_with_invalid_sighashtype()
self.test_fully_signed_tx()
self.test_signing_with_csv()
self.test_signing_with_cltv()