Browse Source

Merge pull request #3593

c7f9332 Add check for valid keys in `importprivkey` (Wladimir J. van der Laan)
0.10
Wladimir J. van der Laan 11 years ago
parent
commit
6ebcec7d3c
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
  1. 4
      src/rpcdump.cpp

4
src/rpcdump.cpp

@ -101,9 +101,11 @@ Value importprivkey(const Array& params, bool fHelp)
CBitcoinSecret vchSecret; CBitcoinSecret vchSecret;
bool fGood = vchSecret.SetString(strSecret); 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(); CKey key = vchSecret.GetKey();
if (!key.IsValid()) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Private key outside allowed range");
CPubKey pubkey = key.GetPubKey(); CPubKey pubkey = key.GetPubKey();
CKeyID vchAddress = pubkey.GetID(); CKeyID vchAddress = pubkey.GetID();
{ {

Loading…
Cancel
Save