diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/rpcdump.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/rpcdump.cpp b/src/rpcdump.cpp index 726f23011b..f66dbc0eb0 100644 --- a/src/rpcdump.cpp +++ b/src/rpcdump.cpp @@ -101,9 +101,11 @@ Value importprivkey(const Array& params, bool fHelp) CBitcoinSecret vchSecret; bool fGood = vchSecret.SetString(strSecret); - if (!fGood) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid private key"); + if (!fGood) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid private key encoding"); CKey key = vchSecret.GetKey(); + if (!key.IsValid()) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Private key outside allowed range"); + CPubKey pubkey = key.GetPubKey(); CKeyID vchAddress = pubkey.GetID(); { |