Add -disablewallet option, to disable wallet support (and BDB)

This commit is contained in:
Jeff Garzik 2013-10-02 11:19:10 -04:00 committed by Wladimir J. van der Laan
parent f9ee7a032b
commit e6b7e3dc79

View File

@ -499,6 +499,7 @@ bool AppInit2(boost::thread_group& threadGroup, bool fForceServer)
fPrintToConsole = GetBoolArg("-printtoconsole", false); fPrintToConsole = GetBoolArg("-printtoconsole", false);
fPrintToDebugger = GetBoolArg("-printtodebugger", false); fPrintToDebugger = GetBoolArg("-printtodebugger", false);
fLogTimestamps = GetBoolArg("-logtimestamps", true); fLogTimestamps = GetBoolArg("-logtimestamps", true);
bool fDisableWallet = GetBoolArg("-disablewallet", false);
if (mapArgs.count("-timeout")) if (mapArgs.count("-timeout"))
{ {
@ -587,7 +588,7 @@ bool AppInit2(boost::thread_group& threadGroup, bool fForceServer)
// ********************************************************* Step 5: verify wallet database integrity // ********************************************************* Step 5: verify wallet database integrity
if (1) { if (!fDisableWallet) {
uiInterface.InitMessage(_("Verifying wallet...")); uiInterface.InitMessage(_("Verifying wallet..."));
if (!bitdb.Open(GetDataDir())) if (!bitdb.Open(GetDataDir()))
@ -631,7 +632,7 @@ bool AppInit2(boost::thread_group& threadGroup, bool fForceServer)
if (r == CDBEnv::RECOVER_FAIL) if (r == CDBEnv::RECOVER_FAIL)
return InitError(_("wallet.dat corrupt, salvage failed")); return InitError(_("wallet.dat corrupt, salvage failed"));
} }
} // (1) } // (!fDisableWallet)
// ********************************************************* Step 6: network initialization // ********************************************************* Step 6: network initialization
@ -900,7 +901,10 @@ bool AppInit2(boost::thread_group& threadGroup, bool fForceServer)
// ********************************************************* Step 8: load wallet // ********************************************************* Step 8: load wallet
if (1) { if (fDisableWallet) {
pwalletMain = NULL;
LogPrintf("Wallet disabled!\n");
} else {
uiInterface.InitMessage(_("Loading wallet...")); uiInterface.InitMessage(_("Loading wallet..."));
nStart = GetTimeMillis(); nStart = GetTimeMillis();
@ -987,7 +991,7 @@ bool AppInit2(boost::thread_group& threadGroup, bool fForceServer)
pwalletMain->SetBestChain(chainActive.GetLocator()); pwalletMain->SetBestChain(chainActive.GetLocator());
nWalletDBUpdated++; nWalletDBUpdated++;
} }
} // (1) } // (!fDisableWallet)
// ********************************************************* Step 9: import blocks // ********************************************************* Step 9: import blocks