Merge #8768: init: Get rid of fDisableWallet
fa58edb [wallet] Introduce DEFAULT_DISABLE_WALLET (MarcoFalke) fab9107 init: Get rid of fDisableWallet (MarcoFalke)
This commit is contained in:
parent
ac3fdd3d27
commit
06f41f3586
53
src/init.cpp
53
src/init.cpp
@ -1103,9 +1103,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);
|
||||
@ -1133,7 +1131,7 @@ 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
|
||||
|
||||
@ -1243,29 +1241,26 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||
|
||||
// ********************************************************* Step 5: Backup wallet and verify wallet database integrity
|
||||
#ifdef ENABLE_WALLET
|
||||
if (!fDisableWallet) {
|
||||
std::string strWarning;
|
||||
std::string strError;
|
||||
std::string strWarning;
|
||||
std::string strError;
|
||||
|
||||
nWalletBackups = GetArg("-createwalletbackups", 10);
|
||||
nWalletBackups = std::max(0, std::min(10, nWalletBackups));
|
||||
nWalletBackups = GetArg("-createwalletbackups", 10);
|
||||
nWalletBackups = std::max(0, std::min(10, nWalletBackups));
|
||||
|
||||
std::string strWalletFile = GetArg("-wallet", DEFAULT_WALLET_DAT);
|
||||
std::string strWalletFile = GetArg("-wallet", DEFAULT_WALLET_DAT);
|
||||
|
||||
if(!AutoBackupWallet(NULL, strWalletFile, strWarning, strError)) {
|
||||
if (!strWarning.empty())
|
||||
InitWarning(strWarning);
|
||||
if (!strError.empty())
|
||||
return InitError(strError);
|
||||
}
|
||||
if(!AutoBackupWallet(NULL, strWalletFile, strWarning, strError)) {
|
||||
if (!strWarning.empty())
|
||||
InitWarning(strWarning);
|
||||
if (!strError.empty())
|
||||
return InitError(strError);
|
||||
}
|
||||
|
||||
if (!CWallet::Verify())
|
||||
return false;
|
||||
if (!CWallet::Verify())
|
||||
return false;
|
||||
|
||||
// Initialize KeePass Integration
|
||||
keePassInt.init();
|
||||
|
||||
} // (!fDisableWallet)
|
||||
// Initialize KeePass Integration
|
||||
keePassInt.init();
|
||||
#endif // ENABLE_WALLET
|
||||
// ********************************************************* Step 6: network initialization
|
||||
// Note that we absolutely cannot open any actual connections
|
||||
@ -1613,17 +1608,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
|
||||
|
||||
|
@ -134,7 +134,7 @@ BitcoinGUI::BitcoinGUI(const PlatformStyle *platformStyle, const NetworkStyle *n
|
||||
QString windowTitle = tr(PACKAGE_NAME) + " - ";
|
||||
#ifdef ENABLE_WALLET
|
||||
/* if compiled with wallet support, -disablewallet can still disable the wallet */
|
||||
enableWallet = !GetBoolArg("-disablewallet", false);
|
||||
enableWallet = !GetBoolArg("-disablewallet", DEFAULT_DISABLE_WALLET);
|
||||
#else
|
||||
enableWallet = false;
|
||||
#endif // ENABLE_WALLET
|
||||
|
@ -2762,6 +2762,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]);
|
||||
}
|
||||
|
@ -596,6 +596,9 @@ void CWallet::Flush(bool shutdown)
|
||||
|
||||
bool CWallet::Verify()
|
||||
{
|
||||
if (GetBoolArg("-disablewallet", DEFAULT_DISABLE_WALLET))
|
||||
return true;
|
||||
|
||||
LogPrintf("Using BerkeleyDB version %s\n", DbEnv::version(0, 0, 0));
|
||||
std::string walletFile = GetArg("-wallet", DEFAULT_WALLET_DAT);
|
||||
|
||||
@ -4561,6 +4564,12 @@ std::string CWallet::GetWalletHelpString(bool showDebug)
|
||||
|
||||
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);
|
||||
|
||||
// needed to restore wallet transaction meta data after -zapwallettxes
|
||||
@ -4758,6 +4767,9 @@ bool CWallet::InitLoadWallet()
|
||||
|
||||
bool CWallet::ParameterInteraction()
|
||||
{
|
||||
if (GetBoolArg("-disablewallet", DEFAULT_DISABLE_WALLET))
|
||||
return true;
|
||||
|
||||
if (GetBoolArg("-blocksonly", DEFAULT_BLOCKSONLY) && SoftSetBoolArg("-walletbroadcast", false)) {
|
||||
LogPrintf("%s: parameter interaction: -blocksonly=1 -> setting -walletbroadcast=0\n", __func__);
|
||||
}
|
||||
|
@ -61,6 +61,7 @@ static const unsigned int DEFAULT_TX_CONFIRM_TARGET = 2;
|
||||
//! Largest (in bytes) free transaction we're willing to create
|
||||
static const unsigned int MAX_FREE_TRANSACTION_CREATE_SIZE = 1000;
|
||||
static const bool DEFAULT_WALLETBROADCAST = true;
|
||||
static const bool DEFAULT_DISABLE_WALLET = false;
|
||||
|
||||
extern const char * DEFAULT_WALLET_DAT;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user