Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/rpcdump.cpp
Show First 20 Lines • Show All 576 Lines • ▼ Show 20 Lines | if (!IsValidDestination(dest)) { | ||||
"Invalid Bitcoin address"); | "Invalid Bitcoin address"); | ||||
} | } | ||||
const CKeyID *keyID = boost::get<CKeyID>(&dest); | const CKeyID *keyID = boost::get<CKeyID>(&dest); | ||||
if (!keyID) { | if (!keyID) { | ||||
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 (!pwalletMain->GetKey(*keyID, vchSecret)) { | if (!pwalletMain->GetKey(*keyID, vchSecret)) { | ||||
throw JSONRPCError(RPC_WALLET_ERROR, "Private key for address " + | throw JSONRPCError(RPC_WALLET_ERROR, | ||||
strAddress + " is not known"); | "Private key for address " + strAddress + | ||||
" is not known"); | |||||
} | } | ||||
return CBitcoinSecret(vchSecret).ToString(); | return CBitcoinSecret(vchSecret).ToString(); | ||||
} | } | ||||
UniValue dumpwallet(const Config &config, const JSONRPCRequest &request) { | UniValue dumpwallet(const Config &config, const JSONRPCRequest &request) { | ||||
if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; | if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; | ||||
if (request.fHelp || request.params.size() != 1) | if (request.fHelp || request.params.size() != 1) | ||||
▲ Show 20 Lines • Show All 655 Lines • Show Last 20 Lines |