aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/rpcwallet.cpp
diff options
context:
space:
mode:
authorSebastian Falbesoner <sebastian.falbesoner@gmail.com>2021-08-26 15:11:17 +0200
committerSebastian Falbesoner <sebastian.falbesoner@gmail.com>2021-11-10 17:12:41 +0100
commitec2792d1dc3404d749a43556eeb4b63780ee6d94 (patch)
treeb89403af31bd5067636f7ea9c55c32b407293dec /src/wallet/rpcwallet.cpp
parent29905c092f15bbbc4d4964c2f99dcf12fefd4111 (diff)
downloadbitcoin-ec2792d1dc3404d749a43556eeb4b63780ee6d94.tar.xz
refactor: use const `LegacyScriptPubKeyMan` references in dump{privkey,wallet} RPCs
Diffstat (limited to 'src/wallet/rpcwallet.cpp')
-rw-r--r--src/wallet/rpcwallet.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp
index 86bfa10d88..babb61b03a 100644
--- a/src/wallet/rpcwallet.cpp
+++ b/src/wallet/rpcwallet.cpp
@@ -150,6 +150,15 @@ LegacyScriptPubKeyMan& EnsureLegacyScriptPubKeyMan(CWallet& wallet, bool also_cr
return *spk_man;
}
+const LegacyScriptPubKeyMan& EnsureConstLegacyScriptPubKeyMan(const CWallet& wallet)
+{
+ const LegacyScriptPubKeyMan* spk_man = wallet.GetLegacyScriptPubKeyMan();
+ if (!spk_man) {
+ throw JSONRPCError(RPC_WALLET_ERROR, "This type of wallet does not support this command");
+ }
+ return *spk_man;
+}
+
static void WalletTxToJSON(const CWallet& wallet, const CWalletTx& wtx, UniValue& entry)
{
interfaces::Chain& chain = wallet.chain();