Browse Source

Merge #8768: init: Get rid of fDisableWallet

fa58edb [wallet] Introduce DEFAULT_DISABLE_WALLET (MarcoFalke)
fab9107 init: Get rid of fDisableWallet (MarcoFalke)
0.14
Wladimir J. van der Laan 8 years ago
parent
commit
886e8c9b72
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
  1. 22
      src/init.cpp
  2. 2
      src/qt/bitcoingui.cpp
  3. 3
      src/wallet/rpcwallet.cpp
  4. 12
      src/wallet/wallet.cpp
  5. 2
      src/wallet/wallet.h

22
src/init.cpp

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

2
src/qt/bitcoingui.cpp

@ -123,7 +123,7 @@ BitcoinGUI::BitcoinGUI(const PlatformStyle *platformStyle, const NetworkStyle *n
QString windowTitle = tr(PACKAGE_NAME) + " - "; QString windowTitle = tr(PACKAGE_NAME) + " - ";
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
/* if compiled with wallet support, -disablewallet can still disable the wallet */ /* if compiled with wallet support, -disablewallet can still disable the wallet */
enableWallet = !GetBoolArg("-disablewallet", false); enableWallet = !GetBoolArg("-disablewallet", DEFAULT_DISABLE_WALLET);
#else #else
enableWallet = false; enableWallet = false;
#endif // ENABLE_WALLET #endif // ENABLE_WALLET

3
src/wallet/rpcwallet.cpp

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

12
src/wallet/wallet.cpp

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

2
src/wallet/wallet.h

@ -59,7 +59,7 @@ static const bool DEFAULT_WALLET_RBF = false;
//! Largest (in bytes) free transaction we're willing to create //! Largest (in bytes) free transaction we're willing to create
static const unsigned int MAX_FREE_TRANSACTION_CREATE_SIZE = 1000; static const unsigned int MAX_FREE_TRANSACTION_CREATE_SIZE = 1000;
static const bool DEFAULT_WALLETBROADCAST = true; static const bool DEFAULT_WALLETBROADCAST = true;
static const bool DEFAULT_DISABLE_WALLET = false;
//! if set, all keys will be derived by using BIP32 //! if set, all keys will be derived by using BIP32
static const bool DEFAULT_USE_HD_WALLET = true; static const bool DEFAULT_USE_HD_WALLET = true;

Loading…
Cancel
Save