Skip to content

Commit 96d0e81

Browse files
MarcoFalkeglozow
authored andcommitted
rpc: Reword SighashFromStr error message
Github-Pull: #29870 Rebased-From: fa6ab0d
1 parent 6685aff commit 96d0e81

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

src/core_read.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,6 @@ util::Result<int> SighashFromStr(const std::string& sighash)
257257
if (it != map_sighash_values.end()) {
258258
return it->second;
259259
} else {
260-
return util::Error{Untranslated(sighash + " is not a valid sighash parameter.")};
260+
return util::Error{Untranslated("'" + sighash + "' is not a valid sighash parameter.")};
261261
}
262262
}

test/functional/rpc_psbt.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,7 @@ def test_psbt_input_keys(psbt_input, keys):
889889
assert_equal(comb_psbt, psbt)
890890

891891
self.log.info("Test walletprocesspsbt raises if an invalid sighashtype is passed")
892-
assert_raises_rpc_error(-8, "all is not a valid sighash parameter.", self.nodes[0].walletprocesspsbt, psbt, sighashtype="all")
892+
assert_raises_rpc_error(-8, "'all' is not a valid sighash parameter.", self.nodes[0].walletprocesspsbt, psbt, sighashtype="all")
893893

894894
self.log.info("Test decoding PSBT with per-input preimage types")
895895
# note that the decodepsbt RPC doesn't check whether preimages and hashes match
@@ -996,7 +996,7 @@ def test_psbt_input_keys(psbt_input, keys):
996996
self.nodes[2].sendrawtransaction(processed_psbt['hex'])
997997

998998
self.log.info("Test descriptorprocesspsbt raises if an invalid sighashtype is passed")
999-
assert_raises_rpc_error(-8, "all is not a valid sighash parameter.", self.nodes[2].descriptorprocesspsbt, psbt, [descriptor], sighashtype="all")
999+
assert_raises_rpc_error(-8, "'all' is not a valid sighash parameter.", self.nodes[2].descriptorprocesspsbt, psbt, [descriptor], sighashtype="all")
10001000

10011001

10021002
if __name__ == '__main__':

test/functional/rpc_signrawtransactionwithkey.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def invalid_sighashtype_test(self):
124124
self.log.info("Test signing transaction with invalid sighashtype")
125125
tx = self.nodes[0].createrawtransaction(INPUTS, OUTPUTS)
126126
privkeys = [self.nodes[0].get_deterministic_priv_key().key]
127-
assert_raises_rpc_error(-8, "all is not a valid sighash parameter.", self.nodes[0].signrawtransactionwithkey, tx, privkeys, sighashtype="all")
127+
assert_raises_rpc_error(-8, "'all' is not a valid sighash parameter.", self.nodes[0].signrawtransactionwithkey, tx, privkeys, sighashtype="all")
128128

129129
def run_test(self):
130130
self.successful_signing_test()

test/functional/wallet_signrawtransactionwithwallet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def test_with_lock_outputs(self):
5656

5757
def test_with_invalid_sighashtype(self):
5858
self.log.info("Test signrawtransactionwithwallet raises if an invalid sighashtype is passed")
59-
assert_raises_rpc_error(-8, "all is not a valid sighash parameter.", self.nodes[0].signrawtransactionwithwallet, hexstring=RAW_TX, sighashtype="all")
59+
assert_raises_rpc_error(-8, "'all' is not a valid sighash parameter.", self.nodes[0].signrawtransactionwithwallet, hexstring=RAW_TX, sighashtype="all")
6060

6161
def script_verification_error_test(self):
6262
"""Create and sign a raw transaction with valid (vin 0), invalid (vin 1) and one missing (vin 2) input script.

0 commit comments

Comments
 (0)