aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2017-11-30 16:48:55 -0800
committerPieter Wuille <pieter.wuille@gmail.com>2018-01-09 15:27:55 -0800
commitcf2c0b6f5cde584d7004ff1b5b476ef54de6b74b (patch)
treee5a5cf921cebe98c930547a5c207eb2481526f68 /src/wallet
parent37c03d3e05713e14458ca2867e442926f165afea (diff)
downloadbitcoin-cf2c0b6f5cde584d7004ff1b5b476ef54de6b74b.tar.xz
Support P2WPKH and P2SH-P2WPKH in dumpprivkey
Diffstat (limited to 'src/wallet')
-rw-r--r--src/wallet/rpcdump.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp
index 71d50be634..81922c5848 100644
--- a/src/wallet/rpcdump.cpp
+++ b/src/wallet/rpcdump.cpp
@@ -578,12 +578,12 @@ UniValue dumpprivkey(const JSONRPCRequest& request)
if (!IsValidDestination(dest)) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Bitcoin address");
}
- const CKeyID *keyID = boost::get<CKeyID>(&dest);
- if (!keyID) {
+ auto keyid = GetKeyForDestination(*pwallet, dest);
+ if (keyid.IsNull()) {
throw JSONRPCError(RPC_TYPE_ERROR, "Address does not refer to a key");
}
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");
}
return CBitcoinSecret(vchSecret).ToString();