diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/chainparamsbase.cpp | 4 | ||||
-rw-r--r-- | src/chainparamsbase.h | 6 | ||||
-rw-r--r-- | src/init.cpp | 14 | ||||
-rw-r--r-- | src/main.cpp | 2 | ||||
-rw-r--r-- | src/qt/bitcoin.cpp | 31 | ||||
-rw-r--r-- | src/rpcnet.cpp | 3 | ||||
-rw-r--r-- | src/util.cpp | 2 |
7 files changed, 40 insertions, 22 deletions
diff --git a/src/chainparamsbase.cpp b/src/chainparamsbase.cpp index 19a9e72cc9..720e24c4a8 100644 --- a/src/chainparamsbase.cpp +++ b/src/chainparamsbase.cpp @@ -91,3 +91,7 @@ bool SelectBaseParamsFromCommandLine() { } return true; } + +bool AreBaseParamsConfigured() { + return pCurrentBaseParams != NULL; +} diff --git a/src/chainparamsbase.h b/src/chainparamsbase.h index 4a3b268909..4398f69548 100644 --- a/src/chainparamsbase.h +++ b/src/chainparamsbase.h @@ -49,4 +49,10 @@ void SelectBaseParams(CBaseChainParams::Network network); */ bool SelectBaseParamsFromCommandLine(); +/** + * Return true if SelectBaseParamsFromCommandLine() has been called to select + * a network. + */ +bool AreBaseParamsConfigured(); + #endif diff --git a/src/init.cpp b/src/init.cpp index 07960ee37b..b80d718f01 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -127,12 +127,14 @@ void Shutdown() StopNode(); UnregisterNodeSignals(GetNodeSignals()); - boost::filesystem::path est_path = GetDataDir() / FEE_ESTIMATES_FILENAME; - CAutoFile est_fileout = CAutoFile(fopen(est_path.string().c_str(), "wb"), SER_DISK, CLIENT_VERSION); - if (est_fileout) - mempool.WriteFeeEstimates(est_fileout); - else - LogPrintf("%s: Failed to write fee estimates to %s\n", __func__, est_path.string()); + { + boost::filesystem::path est_path = GetDataDir() / FEE_ESTIMATES_FILENAME; + CAutoFile est_fileout(fopen(est_path.string().c_str(), "wb"), SER_DISK, CLIENT_VERSION); + if (est_fileout) + mempool.WriteFeeEstimates(est_fileout); + else + LogPrintf("%s: Failed to write fee estimates to %s\n", __func__, est_path.string()); + } { LOCK(cs_main); diff --git a/src/main.cpp b/src/main.cpp index 442feea471..766f0970f0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2517,7 +2517,7 @@ bool AcceptBlock(CBlock& block, CValidationState& state, CBlockIndex** ppindex, return false; if (!CheckBlock(block, state)) { - if (state.Invalid() && !state.CorruptionPossible()) { + if (state.IsInvalid() && !state.CorruptionPossible()) { pindex->nStatus |= BLOCK_FAILED_VALID; } return false; diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index 7c4af25edf..43466663fa 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -34,6 +34,7 @@ #include <boost/filesystem/operations.hpp> #include <QApplication> +#include <QDebug> #include <QLibraryInfo> #include <QLocale> #include <QMessageBox> @@ -237,7 +238,7 @@ void BitcoinCore::initialize() { try { - LogPrintf("Running AppInit2 in thread\n"); + qDebug() << __func__ << ": Running AppInit2 in thread"; int rv = AppInit2(threadGroup); if(rv) { @@ -258,11 +259,11 @@ void BitcoinCore::shutdown() { try { - LogPrintf("Running Shutdown in thread\n"); + qDebug() << __func__ << ": Running Shutdown in thread"; threadGroup.interrupt_all(); threadGroup.join_all(); Shutdown(); - LogPrintf("Shutdown finished\n"); + qDebug() << __func__ << ": Shutdown finished"; emit shutdownResult(1); } catch (std::exception& e) { handleRunawayException(&e); @@ -285,15 +286,17 @@ BitcoinApplication::BitcoinApplication(int &argc, char **argv): returnValue(0) { setQuitOnLastWindowClosed(false); - startThread(); } BitcoinApplication::~BitcoinApplication() { - LogPrintf("Stopping thread\n"); - emit stopThread(); - coreThread->wait(); - LogPrintf("Stopped thread\n"); + if(coreThread) + { + qDebug() << __func__ << ": Stopping thread"; + emit stopThread(); + coreThread->wait(); + qDebug() << __func__ << ": Stopped thread"; + } delete window; window = 0; @@ -336,6 +339,8 @@ void BitcoinApplication::createSplashScreen(bool isaTestNet) void BitcoinApplication::startThread() { + if(coreThread) + return; coreThread = new QThread(this); BitcoinCore *executor = new BitcoinCore(); executor->moveToThread(coreThread); @@ -355,13 +360,15 @@ void BitcoinApplication::startThread() void BitcoinApplication::requestInitialize() { - LogPrintf("Requesting initialize\n"); + qDebug() << __func__ << ": Requesting initialize"; + startThread(); emit requestedInitialize(); } void BitcoinApplication::requestShutdown() { - LogPrintf("Requesting shutdown\n"); + qDebug() << __func__ << ": Requesting shutdown"; + startThread(); window->hide(); window->setClientModel(0); pollShutdownTimer->stop(); @@ -383,7 +390,7 @@ void BitcoinApplication::requestShutdown() void BitcoinApplication::initializeResult(int retval) { - LogPrintf("Initialization result: %i\n", retval); + qDebug() << __func__ << ": Initialization result: " << retval; // Set exit result: 0 if successful, 1 if failure returnValue = retval ? 0 : 1; if(retval) @@ -438,7 +445,7 @@ void BitcoinApplication::initializeResult(int retval) void BitcoinApplication::shutdownResult(int retval) { - LogPrintf("Shutdown result: %i\n", retval); + qDebug() << __func__ << ": Shutdown result: " << retval; quit(); // Exit main loop after shutdown finished } diff --git a/src/rpcnet.cpp b/src/rpcnet.cpp index bd3609b0c9..88e7c4ab07 100644 --- a/src/rpcnet.cpp +++ b/src/rpcnet.cpp @@ -98,8 +98,7 @@ Value getpeerinfo(const Array& params, bool fHelp) " \"syncnode\" : true|false (booleamn) if sync node\n" " }\n" " ,...\n" - "}\n" - + "]\n" "\nExamples:\n" + HelpExampleCli("getpeerinfo", "") + HelpExampleRpc("getpeerinfo", "") diff --git a/src/util.cpp b/src/util.cpp index ce31619eca..d3fa5182f3 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -205,7 +205,7 @@ int LogPrintStr(const std::string &str) // print to console ret = fwrite(str.data(), 1, str.size(), stdout); } - else if (fPrintToDebugLog) + else if (fPrintToDebugLog && AreBaseParamsConfigured()) { static bool fStartedNewLine = true; boost::call_once(&DebugPrintInit, debugPrintInitFlag); |