Replace CBitcoinSecret with {Encode,Decode}Secret

This commit is contained in:
Pieter Wuille
2017-09-19 16:49:52 -07:00
parent ffc6e48b29
commit 32e69fa0df
9 changed files with 62 additions and 118 deletions

View File

@@ -896,13 +896,9 @@ UniValue signrawtransactionwithkey(const JSONRPCRequest& request)
const UniValue& keys = request.params[1].get_array();
for (unsigned int idx = 0; idx < keys.size(); ++idx) {
UniValue k = keys[idx];
CBitcoinSecret vchSecret;
if (!vchSecret.SetString(k.get_str())) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid private key");
}
CKey key = vchSecret.GetKey();
CKey key = DecodeSecret(k.get_str());
if (!key.IsValid()) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Private key outside allowed range");
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid private key");
}
keystore.AddKey(key);
}