Browse Source

init: Get rid of fDisableWallet

0.14
MarcoFalke 8 years ago
parent
commit
fab91070d3
  1. 30
      src/init.cpp
  2. 3
      src/wallet/rpcwallet.cpp
  3. 12
      src/wallet/wallet.cpp

30
src/init.cpp

@ -935,9 +935,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) @@ -935,9 +935,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
RegisterAllCoreRPCCommands(tableRPC);
#ifdef ENABLE_WALLET
bool fDisableWallet = GetBoolArg("-disablewallet", false);
if (!fDisableWallet)
RegisterWalletRPCCommands(tableRPC);
RegisterWalletRPCCommands(tableRPC);
#endif
nConnectTimeout = GetArg("-timeout", DEFAULT_CONNECT_TIMEOUT);
@ -965,9 +963,9 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) @@ -965,9 +963,9 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
nBytesPerSigOp = GetArg("-bytespersigop", nBytesPerSigOp);
#ifdef ENABLE_WALLET
if (!fDisableWallet && !CWallet::ParameterInteraction())
if (!CWallet::ParameterInteraction())
return false;
#endif // ENABLE_WALLET
#endif
fIsBareMultisigStd = GetBoolArg("-permitbaremultisig", DEFAULT_PERMIT_BAREMULTISIG);
fAcceptDatacarrier = GetBoolArg("-datacarrier", DEFAULT_ACCEPT_DATACARRIER);
@ -1095,11 +1093,9 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) @@ -1095,11 +1093,9 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
// ********************************************************* Step 5: verify wallet database integrity
#ifdef ENABLE_WALLET
if (!fDisableWallet) {
if (!CWallet::Verify())
return false;
} // (!fDisableWallet)
#endif // ENABLE_WALLET
if (!CWallet::Verify())
return false;
#endif
// ********************************************************* Step 6: network initialization
assert(!g_connman);
@ -1427,17 +1423,11 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) @@ -1427,17 +1423,11 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
// ********************************************************* Step 8: load wallet
#ifdef ENABLE_WALLET
if (fDisableWallet) {
pwalletMain = NULL;
LogPrintf("Wallet disabled!\n");
} else {
CWallet::InitLoadWallet();
if (!pwalletMain)
return false;
}
#else // ENABLE_WALLET
if (!CWallet::InitLoadWallet())
return false;
#else
LogPrintf("No wallet support compiled in!\n");
#endif // !ENABLE_WALLET
#endif
// ********************************************************* Step 9: data directory maintenance

3
src/wallet/rpcwallet.cpp

@ -2630,6 +2630,9 @@ static const CRPCCommand commands[] = @@ -2630,6 +2630,9 @@ static const CRPCCommand commands[] =
void RegisterWalletRPCCommands(CRPCTable &t)
{
if (GetBoolArg("-disablewallet", false))
return;
for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++)
t.appendCommand(commands[vcidx].name, &commands[vcidx]);
}

12
src/wallet/wallet.cpp

@ -414,6 +414,9 @@ void CWallet::Flush(bool shutdown) @@ -414,6 +414,9 @@ void CWallet::Flush(bool shutdown)
bool CWallet::Verify()
{
if (GetBoolArg("-disablewallet", false))
return true;
LogPrintf("Using BerkeleyDB version %s\n", DbEnv::version(0, 0, 0));
std::string walletFile = GetArg("-wallet", DEFAULT_WALLET_DAT);
@ -3293,6 +3296,12 @@ std::string CWallet::GetWalletHelpString(bool showDebug) @@ -3293,6 +3296,12 @@ std::string CWallet::GetWalletHelpString(bool showDebug)
bool CWallet::InitLoadWallet()
{
if (GetBoolArg("-disablewallet", false)) {
pwalletMain = NULL;
LogPrintf("Wallet disabled!\n");
return true;
}
std::string walletFile = GetArg("-wallet", DEFAULT_WALLET_DAT);
// needed to restore wallet transaction meta data after -zapwallettxes
@ -3464,6 +3473,9 @@ bool CWallet::InitLoadWallet() @@ -3464,6 +3473,9 @@ bool CWallet::InitLoadWallet()
bool CWallet::ParameterInteraction()
{
if (GetBoolArg("-disablewallet", false))
return true;
if (GetBoolArg("-blocksonly", DEFAULT_BLOCKSONLY) && SoftSetBoolArg("-walletbroadcast", false)) {
LogPrintf("%s: parameter interaction: -blocksonly=1 -> setting -walletbroadcast=0\n", __func__);
}

Loading…
Cancel
Save