mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-18 13:17:55 +02:00
Replace CBitcoinSecret with {Encode,Decode}Secret
This commit is contained in:
parent
ffc6e48b29
commit
32e69fa0df
9 changed files with 62 additions and 118 deletions
|
|
@ -224,13 +224,10 @@ UniValue signmessagewithprivkey(const JSONRPCRequest& request)
|
|||
std::string strPrivkey = request.params[0].get_str();
|
||||
std::string strMessage = request.params[1].get_str();
|
||||
|
||||
CBitcoinSecret vchSecret;
|
||||
bool fGood = vchSecret.SetString(strPrivkey);
|
||||
if (!fGood)
|
||||
CKey key = DecodeSecret(strPrivkey);
|
||||
if (!key.IsValid()) {
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid private key");
|
||||
CKey key = vchSecret.GetKey();
|
||||
if (!key.IsValid())
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Private key outside allowed range");
|
||||
}
|
||||
|
||||
CHashWriter ss(SER_GETHASH, 0);
|
||||
ss << strMessageMagic;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue