diff options
| author | Wladimir J. van der Laan <[email protected]> | 2014-01-28 18:38:10 +0100 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2014-01-28 18:38:31 +0100 |
| commit | 6ebcec7d3c3532be840132d7d9345b82b3b93260 (patch) | |
| tree | 6fb90ecba444da943d9c259c640fb48f8eed767b | |
| parent | Merge pull request #3590 (diff) | |
| parent | Add check for valid keys in `importprivkey` (diff) | |
| download | discoin-6ebcec7d3c3532be840132d7d9345b82b3b93260.tar.xz discoin-6ebcec7d3c3532be840132d7d9345b82b3b93260.zip | |
Merge pull request #3593
c7f9332 Add check for valid keys in `importprivkey` (Wladimir J. van der Laan)
| -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 726f23011..f66dbc0eb 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(); { |