mirror of
https://github.com/dashpay/dash.git
synced 2024-12-29 13:59:06 +01:00
Support P2WPKH and P2SH-P2WPKH in dumpprivkey
This commit is contained in:
parent
37c03d3e05
commit
cf2c0b6f5c
@ -578,12 +578,12 @@ UniValue dumpprivkey(const JSONRPCRequest& request)
|
|||||||
if (!IsValidDestination(dest)) {
|
if (!IsValidDestination(dest)) {
|
||||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Bitcoin address");
|
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Bitcoin address");
|
||||||
}
|
}
|
||||||
const CKeyID *keyID = boost::get<CKeyID>(&dest);
|
auto keyid = GetKeyForDestination(*pwallet, dest);
|
||||||
if (!keyID) {
|
if (keyid.IsNull()) {
|
||||||
throw JSONRPCError(RPC_TYPE_ERROR, "Address does not refer to a key");
|
throw JSONRPCError(RPC_TYPE_ERROR, "Address does not refer to a key");
|
||||||
}
|
}
|
||||||
CKey vchSecret;
|
CKey vchSecret;
|
||||||
if (!pwallet->GetKey(*keyID, vchSecret)) {
|
if (!pwallet->GetKey(keyid, vchSecret)) {
|
||||||
throw JSONRPCError(RPC_WALLET_ERROR, "Private key for address " + strAddress + " is not known");
|
throw JSONRPCError(RPC_WALLET_ERROR, "Private key for address " + strAddress + " is not known");
|
||||||
}
|
}
|
||||||
return CBitcoinSecret(vchSecret).ToString();
|
return CBitcoinSecret(vchSecret).ToString();
|
||||||
|
Loading…
Reference in New Issue
Block a user