mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-08-27 19:39:02 +02:00
rpc: fix {sign,message}verify RPC errors for invalid address/signature
This commit is contained in:
@@ -300,11 +300,11 @@ static RPCHelpMan verifymessage()
|
||||
|
||||
switch (MessageVerify(strAddress, strSign, strMessage)) {
|
||||
case MessageVerificationResult::ERR_INVALID_ADDRESS:
|
||||
throw JSONRPCError(RPC_TYPE_ERROR, "Invalid address");
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid address");
|
||||
case MessageVerificationResult::ERR_ADDRESS_NO_KEY:
|
||||
throw JSONRPCError(RPC_TYPE_ERROR, "Address does not refer to key");
|
||||
case MessageVerificationResult::ERR_MALFORMED_SIGNATURE:
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Malformed base64 encoding");
|
||||
throw JSONRPCError(RPC_TYPE_ERROR, "Malformed base64 encoding");
|
||||
case MessageVerificationResult::ERR_PUBKEY_NOT_RECOVERED:
|
||||
case MessageVerificationResult::ERR_NOT_SIGNED:
|
||||
return false;
|
||||
|
@@ -602,7 +602,7 @@ static UniValue signmessage(const JSONRPCRequest& request)
|
||||
|
||||
CTxDestination dest = DecodeDestination(strAddress);
|
||||
if (!IsValidDestination(dest)) {
|
||||
throw JSONRPCError(RPC_TYPE_ERROR, "Invalid address");
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid address");
|
||||
}
|
||||
|
||||
const PKHash *pkhash = boost::get<PKHash>(&dest);
|
||||
|
Reference in New Issue
Block a user