Skip to content

Commit 290f3c5

Browse files
committed
[wallet] Add RegisterWalletRPC() function to wallet/init.cpp
1 parent 062d631 commit 290f3c5

File tree

5 files changed

+17
-4
lines changed

5 files changed

+17
-4
lines changed

src/init.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1017,7 +1017,7 @@ bool AppInitParameterInteraction()
10171017

10181018
RegisterAllCoreRPCCommands(tableRPC);
10191019
#ifdef ENABLE_WALLET
1020-
RegisterWalletRPCCommands(tableRPC);
1020+
RegisterWalletRPC(tableRPC);
10211021
#endif
10221022

10231023
nConnectTimeout = gArgs.GetArg("-timeout", DEFAULT_CONNECT_TIMEOUT);

src/wallet/init.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "utilmoneystr.h"
1111
#include "validation.h"
1212
#include "wallet/wallet.h"
13+
#include "wallet/rpcwallet.h"
1314

1415
std::string GetWalletHelpString(bool showDebug)
1516
{
@@ -171,6 +172,13 @@ bool WalletParameterInteraction()
171172
return true;
172173
}
173174

175+
void RegisterWalletRPC(CRPCTable &t)
176+
{
177+
if (gArgs.GetBoolArg("-disablewallet", false)) return;
178+
179+
RegisterWalletRPCCommands(t);
180+
}
181+
174182
bool VerifyWallets()
175183
{
176184
if (gArgs.GetBoolArg("-disablewallet", DEFAULT_DISABLE_WALLET))

src/wallet/init.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,17 @@
88

99
#include <string>
1010

11+
class CRPCTable;
12+
1113
//! Return the wallets help message.
1214
std::string GetWalletHelpString(bool showDebug);
1315

1416
//! Wallets parameter interaction
1517
bool WalletParameterInteraction();
1618

19+
//! Register wallet RPCs.
20+
void RegisterWalletRPC(CRPCTable &tableRPC);
21+
1722
//! Responsible for reading and validating the -wallet arguments and verifying the wallet database.
1823
// This function will perform salvage on the wallet if requested, as long as only one wallet is
1924
// being loaded (CWallet::ParameterInteraction forbids -salvagewallet, -zapwallettxes or -upgradewallet with multiwallet).

src/wallet/rpcwallet.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3217,9 +3217,6 @@ static const CRPCCommand commands[] =
32173217

32183218
void RegisterWalletRPCCommands(CRPCTable &t)
32193219
{
3220-
if (gArgs.GetBoolArg("-disablewallet", false))
3221-
return;
3222-
32233220
for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++)
32243221
t.appendCommand(commands[vcidx].name, &commands[vcidx]);
32253222
}

src/wallet/rpcwallet.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
#ifndef BITCOIN_WALLET_RPCWALLET_H
66
#define BITCOIN_WALLET_RPCWALLET_H
77

8+
#include <string>
9+
810
class CRPCTable;
11+
class CWallet;
912
class JSONRPCRequest;
1013

1114
void RegisterWalletRPCCommands(CRPCTable &t);

0 commit comments

Comments
 (0)