Skip to content

Commit afa6b3b

Browse files
authored
Merge pull request gridcoin-community#2556 from barton2526/error-codes
rpc: fix invalid parameter error codes for {sign,verify}message RPCs
2 parents 271c0ce + f9f2e2b commit afa6b3b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/wallet/rpcwallet.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ UniValue signmessage(const UniValue& params, bool fHelp)
458458

459459
CBitcoinAddress addr(strAddress);
460460
if (!addr.IsValid())
461-
throw JSONRPCError(RPC_TYPE_ERROR, "Invalid address");
461+
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid address");
462462

463463
CKeyID keyID;
464464
if (!addr.GetKeyID(keyID))
@@ -495,7 +495,7 @@ UniValue verifymessage(const UniValue& params, bool fHelp)
495495

496496
CBitcoinAddress addr(strAddress);
497497
if (!addr.IsValid())
498-
throw JSONRPCError(RPC_TYPE_ERROR, "Invalid address");
498+
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid address");
499499

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

507507
if (fInvalid)
508-
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Malformed base64 encoding");
508+
throw JSONRPCError(RPC_TYPE_ERROR, "Malformed base64 encoding");
509509

510510
CDataStream ss(SER_GETHASH, 0);
511511
ss << strMessageMagic;

0 commit comments

Comments
 (0)