Skip to content

Commit fab9107

Browse files
author
MarcoFalke
committed
init: Get rid of fDisableWallet
1 parent 1c24d5f commit fab9107

File tree

3 files changed

+25
-20
lines changed

3 files changed

+25
-20
lines changed

src/init.cpp

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -935,9 +935,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
935935

936936
RegisterAllCoreRPCCommands(tableRPC);
937937
#ifdef ENABLE_WALLET
938-
bool fDisableWallet = GetBoolArg("-disablewallet", false);
939-
if (!fDisableWallet)
940-
RegisterWalletRPCCommands(tableRPC);
938+
RegisterWalletRPCCommands(tableRPC);
941939
#endif
942940

943941
nConnectTimeout = GetArg("-timeout", DEFAULT_CONNECT_TIMEOUT);
@@ -965,9 +963,9 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
965963
nBytesPerSigOp = GetArg("-bytespersigop", nBytesPerSigOp);
966964

967965
#ifdef ENABLE_WALLET
968-
if (!fDisableWallet && !CWallet::ParameterInteraction())
966+
if (!CWallet::ParameterInteraction())
969967
return false;
970-
#endif // ENABLE_WALLET
968+
#endif
971969

972970
fIsBareMultisigStd = GetBoolArg("-permitbaremultisig", DEFAULT_PERMIT_BAREMULTISIG);
973971
fAcceptDatacarrier = GetBoolArg("-datacarrier", DEFAULT_ACCEPT_DATACARRIER);
@@ -1095,11 +1093,9 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
10951093

10961094
// ********************************************************* Step 5: verify wallet database integrity
10971095
#ifdef ENABLE_WALLET
1098-
if (!fDisableWallet) {
1099-
if (!CWallet::Verify())
1100-
return false;
1101-
} // (!fDisableWallet)
1102-
#endif // ENABLE_WALLET
1096+
if (!CWallet::Verify())
1097+
return false;
1098+
#endif
11031099
// ********************************************************* Step 6: network initialization
11041100

11051101
assert(!g_connman);
@@ -1427,17 +1423,11 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
14271423

14281424
// ********************************************************* Step 8: load wallet
14291425
#ifdef ENABLE_WALLET
1430-
if (fDisableWallet) {
1431-
pwalletMain = NULL;
1432-
LogPrintf("Wallet disabled!\n");
1433-
} else {
1434-
CWallet::InitLoadWallet();
1435-
if (!pwalletMain)
1436-
return false;
1437-
}
1438-
#else // ENABLE_WALLET
1426+
if (!CWallet::InitLoadWallet())
1427+
return false;
1428+
#else
14391429
LogPrintf("No wallet support compiled in!\n");
1440-
#endif // !ENABLE_WALLET
1430+
#endif
14411431

14421432
// ********************************************************* Step 9: data directory maintenance
14431433

src/wallet/rpcwallet.cpp

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

26312631
void RegisterWalletRPCCommands(CRPCTable &t)
26322632
{
2633+
if (GetBoolArg("-disablewallet", false))
2634+
return;
2635+
26332636
for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++)
26342637
t.appendCommand(commands[vcidx].name, &commands[vcidx]);
26352638
}

src/wallet/wallet.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,9 @@ void CWallet::Flush(bool shutdown)
414414

415415
bool CWallet::Verify()
416416
{
417+
if (GetBoolArg("-disablewallet", false))
418+
return true;
419+
417420
LogPrintf("Using BerkeleyDB version %s\n", DbEnv::version(0, 0, 0));
418421
std::string walletFile = GetArg("-wallet", DEFAULT_WALLET_DAT);
419422

@@ -3293,6 +3296,12 @@ std::string CWallet::GetWalletHelpString(bool showDebug)
32933296

32943297
bool CWallet::InitLoadWallet()
32953298
{
3299+
if (GetBoolArg("-disablewallet", false)) {
3300+
pwalletMain = NULL;
3301+
LogPrintf("Wallet disabled!\n");
3302+
return true;
3303+
}
3304+
32963305
std::string walletFile = GetArg("-wallet", DEFAULT_WALLET_DAT);
32973306

32983307
// needed to restore wallet transaction meta data after -zapwallettxes
@@ -3464,6 +3473,9 @@ bool CWallet::InitLoadWallet()
34643473

34653474
bool CWallet::ParameterInteraction()
34663475
{
3476+
if (GetBoolArg("-disablewallet", false))
3477+
return true;
3478+
34673479
if (GetBoolArg("-blocksonly", DEFAULT_BLOCKSONLY) && SoftSetBoolArg("-walletbroadcast", false)) {
34683480
LogPrintf("%s: parameter interaction: -blocksonly=1 -> setting -walletbroadcast=0\n", __func__);
34693481
}

0 commit comments

Comments
 (0)