Skip to content

Commit

Permalink
Merge pull request #2556 from barton2526/error-codes
Browse files Browse the repository at this point in the history
rpc: fix invalid parameter error codes for {sign,verify}message RPCs
  • Loading branch information
jamescowens authored Aug 1, 2022
2 parents 271c0ce + f9f2e2b commit afa6b3b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/wallet/rpcwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ UniValue signmessage(const UniValue& params, bool fHelp)

CBitcoinAddress addr(strAddress);
if (!addr.IsValid())
throw JSONRPCError(RPC_TYPE_ERROR, "Invalid address");
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid address");

CKeyID keyID;
if (!addr.GetKeyID(keyID))
Expand Down Expand Up @@ -495,7 +495,7 @@ UniValue verifymessage(const UniValue& params, bool fHelp)

CBitcoinAddress addr(strAddress);
if (!addr.IsValid())
throw JSONRPCError(RPC_TYPE_ERROR, "Invalid address");
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid address");

CKeyID keyID;
if (!addr.GetKeyID(keyID))
Expand All @@ -505,7 +505,7 @@ UniValue verifymessage(const UniValue& params, bool fHelp)
vector<unsigned char> vchSig = DecodeBase64(strSign.c_str(), &fInvalid);

if (fInvalid)
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Malformed base64 encoding");
throw JSONRPCError(RPC_TYPE_ERROR, "Malformed base64 encoding");

CDataStream ss(SER_GETHASH, 0);
ss << strMessageMagic;
Expand Down

0 comments on commit afa6b3b

Please sign in to comment.