Unbreak things by undoing a line accidentally deleted from LoadBlockIndex, derp
This commit is contained in:
@@ -81,7 +81,7 @@ void WaitForShutdown(boost::thread_group* threadGroup)
|
|||||||
|
|
||||||
while (!fShutdown)
|
while (!fShutdown)
|
||||||
{
|
{
|
||||||
fprintf(stderr,"call passport iteration\n");
|
//fprintf(stderr,"call passport iteration\n");
|
||||||
if ( ASSETCHAINS_SYMBOL[0] == 0 )
|
if ( ASSETCHAINS_SYMBOL[0] == 0 )
|
||||||
{
|
{
|
||||||
if ( KOMODO_NSPV_FULLNODE )
|
if ( KOMODO_NSPV_FULLNODE )
|
||||||
@@ -108,7 +108,7 @@ void WaitForShutdown(boost::thread_group* threadGroup)
|
|||||||
}
|
}
|
||||||
fShutdown = ShutdownRequested();
|
fShutdown = ShutdownRequested();
|
||||||
}
|
}
|
||||||
fprintf(stderr,"%s: fShutdown=%d\n", __FUNCTION__, fShutdown);
|
//fprintf(stderr,"%s: fShutdown=%d\n", __FUNCTION__, fShutdown);
|
||||||
|
|
||||||
if (threadGroup)
|
if (threadGroup)
|
||||||
{
|
{
|
||||||
@@ -135,7 +135,7 @@ bool AppInit(int argc, char* argv[])
|
|||||||
bool fRet = false;
|
bool fRet = false;
|
||||||
|
|
||||||
|
|
||||||
fprintf(stderr, "%s start, argc=%d\n", __FUNCTION__, argc);
|
//fprintf(stderr, "%s start, argc=%d\n", __FUNCTION__, argc);
|
||||||
//
|
//
|
||||||
// Parameters
|
// Parameters
|
||||||
//
|
//
|
||||||
@@ -251,9 +251,9 @@ bool AppInit(int argc, char* argv[])
|
|||||||
#endif
|
#endif
|
||||||
SoftSetBoolArg("-server", true);
|
SoftSetBoolArg("-server", true);
|
||||||
|
|
||||||
fprintf(stderr,"%s: Running AppInit2()\n", __FUNCTION__);
|
//fprintf(stderr,"%s: Running AppInit2()\n", __FUNCTION__);
|
||||||
fRet = AppInit2(threadGroup, scheduler);
|
fRet = AppInit2(threadGroup, scheduler);
|
||||||
fprintf(stderr,"%s: Finished AppInit2(), fRet=%d\n", __FUNCTION__, fRet);
|
//fprintf(stderr,"%s: Finished AppInit2(), fRet=%d\n", __FUNCTION__, fRet);
|
||||||
} catch (const std::exception& e) {
|
} catch (const std::exception& e) {
|
||||||
PrintExceptionContinue(&e, "AppInit()");
|
PrintExceptionContinue(&e, "AppInit()");
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
@@ -261,13 +261,13 @@ bool AppInit(int argc, char* argv[])
|
|||||||
}
|
}
|
||||||
if (!fRet)
|
if (!fRet)
|
||||||
{
|
{
|
||||||
fprintf(stderr,"%s: Interrupting threadGroup\n", __FUNCTION__);
|
//fprintf(stderr,"%s: Interrupting threadGroup\n", __FUNCTION__);
|
||||||
Interrupt(threadGroup);
|
Interrupt(threadGroup);
|
||||||
// threadGroup.join_all(); was left out intentionally here, because we didn't re-test all of
|
// threadGroup.join_all(); was left out intentionally here, because we didn't re-test all of
|
||||||
// the startup-failure cases to make sure they don't result in a hang due to some
|
// the startup-failure cases to make sure they don't result in a hang due to some
|
||||||
// thread-blocking-waiting-for-another-thread-during-startup case
|
// thread-blocking-waiting-for-another-thread-during-startup case
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr,"%s: Waiting for Shutdown\n", __FUNCTION__);
|
//fprintf(stderr,"%s: Waiting for Shutdown\n", __FUNCTION__);
|
||||||
WaitForShutdown(&threadGroup);
|
WaitForShutdown(&threadGroup);
|
||||||
}
|
}
|
||||||
Shutdown();
|
Shutdown();
|
||||||
|
|||||||
54
src/init.cpp
54
src/init.cpp
@@ -958,11 +958,11 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
return InitError("Error: -sysperms is not allowed in combination with enabled wallet functionality");
|
return InitError("Error: -sysperms is not allowed in combination with enabled wallet functionality");
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr,"%s setting umask\n", __FUNCTION__);
|
//fprintf(stderr,"%s setting umask\n", __FUNCTION__);
|
||||||
umask(077);
|
umask(077);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr,"%s tik1\n", __FUNCTION__);
|
//fprintf(stderr,"%s tik1\n", __FUNCTION__);
|
||||||
// Clean shutdown on SIGTERM
|
// Clean shutdown on SIGTERM
|
||||||
struct sigaction sa;
|
struct sigaction sa;
|
||||||
sa.sa_handler = HandleSIGTERM;
|
sa.sa_handler = HandleSIGTERM;
|
||||||
@@ -1010,7 +1010,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
return InitError(_("RPC method z_mergetoaddress requires -experimentalfeatures."));
|
return InitError(_("RPC method z_mergetoaddress requires -experimentalfeatures."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fprintf(stderr,"%s tik2\n", __FUNCTION__);
|
//fprintf(stderr,"%s tik2\n", __FUNCTION__);
|
||||||
|
|
||||||
// Set this early so that parameter interactions go to console
|
// Set this early so that parameter interactions go to console
|
||||||
fPrintToConsole = GetBoolArg("-printtoconsole", false);
|
fPrintToConsole = GetBoolArg("-printtoconsole", false);
|
||||||
@@ -1032,7 +1032,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
LogPrintf("%s: parameter interaction: -whitebind set -> setting -listen=1\n", __func__);
|
LogPrintf("%s: parameter interaction: -whitebind set -> setting -listen=1\n", __func__);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr,"%s tik3\n", __FUNCTION__);
|
//fprintf(stderr,"%s tik3\n", __FUNCTION__);
|
||||||
if (mapArgs.count("-connect") && mapMultiArgs["-connect"].size() > 0) {
|
if (mapArgs.count("-connect") && mapMultiArgs["-connect"].size() > 0) {
|
||||||
// when only connecting to trusted nodes, do not seed via DNS, or listen by default
|
// when only connecting to trusted nodes, do not seed via DNS, or listen by default
|
||||||
if (SoftSetBoolArg("-dnsseed", false))
|
if (SoftSetBoolArg("-dnsseed", false))
|
||||||
@@ -1075,7 +1075,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
if (SoftSetBoolArg("-rescan", true))
|
if (SoftSetBoolArg("-rescan", true))
|
||||||
LogPrintf("%s: parameter interaction: -zapwallettxes=<mode> -> setting -rescan=1\n", __func__);
|
LogPrintf("%s: parameter interaction: -zapwallettxes=<mode> -> setting -rescan=1\n", __func__);
|
||||||
}
|
}
|
||||||
fprintf(stderr,"%s tik4\n", __FUNCTION__);
|
//fprintf(stderr,"%s tik4\n", __FUNCTION__);
|
||||||
|
|
||||||
// Make sure enough file descriptors are available
|
// Make sure enough file descriptors are available
|
||||||
int nBind = std::max((int)mapArgs.count("-bind") + (int)mapArgs.count("-whitebind"), 1);
|
int nBind = std::max((int)mapArgs.count("-bind") + (int)mapArgs.count("-whitebind"), 1);
|
||||||
@@ -1088,7 +1088,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
return InitError(_("Not enough file descriptors available."));
|
return InitError(_("Not enough file descriptors available."));
|
||||||
if (nFD - MIN_CORE_FILEDESCRIPTORS < nMaxConnections)
|
if (nFD - MIN_CORE_FILEDESCRIPTORS < nMaxConnections)
|
||||||
nMaxConnections = nFD - MIN_CORE_FILEDESCRIPTORS;
|
nMaxConnections = nFD - MIN_CORE_FILEDESCRIPTORS;
|
||||||
fprintf(stderr,"nMaxConnections %d\n",nMaxConnections);
|
//fprintf(stderr,"nMaxConnections %d\n",nMaxConnections);
|
||||||
// if using block pruning, then disable txindex
|
// if using block pruning, then disable txindex
|
||||||
// also disable the wallet (for now, until SPV support is implemented in wallet)
|
// also disable the wallet (for now, until SPV support is implemented in wallet)
|
||||||
if (GetArg("-prune", 0)) {
|
if (GetArg("-prune", 0)) {
|
||||||
@@ -1121,7 +1121,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr,"%s tik5\n", __FUNCTION__);
|
//fprintf(stderr,"%s tik5\n", __FUNCTION__);
|
||||||
// Check for -debugnet
|
// Check for -debugnet
|
||||||
if (GetBoolArg("-debugnet", false))
|
if (GetBoolArg("-debugnet", false))
|
||||||
InitWarning(_("Warning: Unsupported argument -debugnet ignored, use -debug=net."));
|
InitWarning(_("Warning: Unsupported argument -debugnet ignored, use -debug=net."));
|
||||||
@@ -1153,7 +1153,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
nScriptCheckThreads = MAX_SCRIPTCHECK_THREADS;
|
nScriptCheckThreads = MAX_SCRIPTCHECK_THREADS;
|
||||||
|
|
||||||
fServer = GetBoolArg("-server", false);
|
fServer = GetBoolArg("-server", false);
|
||||||
fprintf(stderr,"%s tik6\n", __FUNCTION__);
|
//fprintf(stderr,"%s tik6\n", __FUNCTION__);
|
||||||
|
|
||||||
// block pruning; get the amount of disk space (in MB) to allot for block & undo files
|
// block pruning; get the amount of disk space (in MB) to allot for block & undo files
|
||||||
int64_t nSignedPruneTarget = GetArg("-prune", 0) * 1024 * 1024;
|
int64_t nSignedPruneTarget = GetArg("-prune", 0) * 1024 * 1024;
|
||||||
@@ -1241,7 +1241,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
expiryDelta = GetArg("-txexpirydelta", DEFAULT_TX_EXPIRY_DELTA);
|
expiryDelta = GetArg("-txexpirydelta", DEFAULT_TX_EXPIRY_DELTA);
|
||||||
bSpendZeroConfChange = GetBoolArg("-spendzeroconfchange", true);
|
bSpendZeroConfChange = GetBoolArg("-spendzeroconfchange", true);
|
||||||
fSendFreeTransactions = GetBoolArg("-sendfreetransactions", false);
|
fSendFreeTransactions = GetBoolArg("-sendfreetransactions", false);
|
||||||
fprintf(stderr,"%s tik7\n", __FUNCTION__);
|
//fprintf(stderr,"%s tik7\n", __FUNCTION__);
|
||||||
|
|
||||||
std::string strWalletFile = GetArg("-wallet", "wallet.dat");
|
std::string strWalletFile = GetArg("-wallet", "wallet.dat");
|
||||||
#endif // ENABLE_WALLET
|
#endif // ENABLE_WALLET
|
||||||
@@ -1260,7 +1260,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
nLocalServices |= NODE_BLOOM;
|
nLocalServices |= NODE_BLOOM;
|
||||||
}
|
}
|
||||||
nMaxTipAge = GetArg("-maxtipage", DEFAULT_MAX_TIP_AGE);
|
nMaxTipAge = GetArg("-maxtipage", DEFAULT_MAX_TIP_AGE);
|
||||||
fprintf(stderr,"%s tik8\n", __FUNCTION__);
|
//fprintf(stderr,"%s tik8\n", __FUNCTION__);
|
||||||
|
|
||||||
#ifdef ENABLE_MINING
|
#ifdef ENABLE_MINING
|
||||||
if (mapArgs.count("-mineraddress")) {
|
if (mapArgs.count("-mineraddress")) {
|
||||||
@@ -1283,7 +1283,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr,"%s tik9\n", __FUNCTION__);
|
//fprintf(stderr,"%s tik9\n", __FUNCTION__);
|
||||||
if (!mapMultiArgs["-nuparams"].empty()) {
|
if (!mapMultiArgs["-nuparams"].empty()) {
|
||||||
// Allow overriding network upgrade parameters for testing
|
// Allow overriding network upgrade parameters for testing
|
||||||
if (Params().NetworkIDString() != "regtest") {
|
if (Params().NetworkIDString() != "regtest") {
|
||||||
@@ -1329,6 +1329,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
ECC_Start();
|
ECC_Start();
|
||||||
globalVerifyHandle.reset(new ECCVerifyHandle());
|
globalVerifyHandle.reset(new ECCVerifyHandle());
|
||||||
|
|
||||||
|
/*
|
||||||
// set the hash algorithm to use for this chain
|
// set the hash algorithm to use for this chain
|
||||||
// Again likely better solution here, than using long IF ELSE.
|
// Again likely better solution here, than using long IF ELSE.
|
||||||
extern uint32_t ASSETCHAINS_ALGO, ASSETCHAINS_VERUSHASH, ASSETCHAINS_VERUSHASHV1_1;
|
extern uint32_t ASSETCHAINS_ALGO, ASSETCHAINS_VERUSHASH, ASSETCHAINS_VERUSHASHV1_1;
|
||||||
@@ -1344,8 +1345,9 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
// initialize VerusHashV2
|
// initialize VerusHashV2
|
||||||
CBlockHeader::SetVerusHashV2();
|
CBlockHeader::SetVerusHashV2();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
fprintf(stderr,"%s tik10\n", __FUNCTION__);
|
//fprintf(stderr,"%s tik10\n", __FUNCTION__);
|
||||||
// Sanity check
|
// Sanity check
|
||||||
if (!InitSanityCheck())
|
if (!InitSanityCheck())
|
||||||
return InitError(_("Initialization sanity check failed. Please check for insanity. Hush is shutting down!"));
|
return InitError(_("Initialization sanity check failed. Please check for insanity. Hush is shutting down!"));
|
||||||
@@ -1362,7 +1364,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
if (file) fclose(file);
|
if (file) fclose(file);
|
||||||
|
|
||||||
|
|
||||||
fprintf(stderr,"%s tik11\n", __FUNCTION__);
|
//fprintf(stderr,"%s tik11\n", __FUNCTION__);
|
||||||
fprintf(stderr,"Attempting to obtain lock %s\n", pathLockFile.string().c_str());
|
fprintf(stderr,"Attempting to obtain lock %s\n", pathLockFile.string().c_str());
|
||||||
try {
|
try {
|
||||||
static boost::interprocess::file_lock lock(pathLockFile.string().c_str());
|
static boost::interprocess::file_lock lock(pathLockFile.string().c_str());
|
||||||
@@ -1378,7 +1380,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
if (GetBoolArg("-shrinkdebugfile", !fDebug))
|
if (GetBoolArg("-shrinkdebugfile", !fDebug))
|
||||||
ShrinkDebugFile();
|
ShrinkDebugFile();
|
||||||
|
|
||||||
fprintf(stderr,"%s tik12\n", __FUNCTION__);
|
//fprintf(stderr,"%s tik12\n", __FUNCTION__);
|
||||||
|
|
||||||
LogPrintf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
|
LogPrintf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
|
||||||
LogPrintf("Hush version %s (%s)\n", FormatFullVersion(), CLIENT_DATE);
|
LogPrintf("Hush version %s (%s)\n", FormatFullVersion(), CLIENT_DATE);
|
||||||
@@ -1403,7 +1405,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
threadGroup.create_thread(&ThreadScriptCheck);
|
threadGroup.create_thread(&ThreadScriptCheck);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr,"%s tik13\n", __FUNCTION__);
|
//fprintf(stderr,"%s tik13\n", __FUNCTION__);
|
||||||
|
|
||||||
// Start the lightweight task scheduler thread
|
// Start the lightweight task scheduler thread
|
||||||
CScheduler::Function serviceLoop = boost::bind(&CScheduler::serviceQueue, &scheduler);
|
CScheduler::Function serviceLoop = boost::bind(&CScheduler::serviceQueue, &scheduler);
|
||||||
@@ -1411,7 +1413,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
|
|
||||||
// Count uptime
|
// Count uptime
|
||||||
MarkStartTime();
|
MarkStartTime();
|
||||||
fprintf(stderr,"%s tik14\n", __FUNCTION__);
|
//fprintf(stderr,"%s tik14\n", __FUNCTION__);
|
||||||
|
|
||||||
if ((chainparams.NetworkIDString() != "regtest") &&
|
if ((chainparams.NetworkIDString() != "regtest") &&
|
||||||
GetBoolArg("-showmetrics", 0) &&
|
GetBoolArg("-showmetrics", 0) &&
|
||||||
@@ -1421,7 +1423,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
threadGroup.create_thread(&ThreadShowMetricsScreen);
|
threadGroup.create_thread(&ThreadShowMetricsScreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr,"%s tik15\n", __FUNCTION__);
|
//fprintf(stderr,"%s tik15\n", __FUNCTION__);
|
||||||
// These must be disabled for now, they are buggy and we probably don't
|
// These must be disabled for now, they are buggy and we probably don't
|
||||||
// want any of libsnark's profiling in production anyway.
|
// want any of libsnark's profiling in production anyway.
|
||||||
libsnark::inhibit_profiling_info = true;
|
libsnark::inhibit_profiling_info = true;
|
||||||
@@ -1443,7 +1445,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
if (!AppInitServers(threadGroup))
|
if (!AppInitServers(threadGroup))
|
||||||
return InitError(_("Unable to start HTTP server. See debug log for details."));
|
return InitError(_("Unable to start HTTP server. See debug log for details."));
|
||||||
}
|
}
|
||||||
fprintf(stderr,"%s tik16\n", __FUNCTION__);
|
//fprintf(stderr,"%s tik16\n", __FUNCTION__);
|
||||||
|
|
||||||
int64_t nStart;
|
int64_t nStart;
|
||||||
|
|
||||||
@@ -1468,7 +1470,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
#endif // ENABLE_WALLET
|
#endif // ENABLE_WALLET
|
||||||
// ********************************************************* Step 6: network initialization
|
// ********************************************************* Step 6: network initialization
|
||||||
|
|
||||||
fprintf(stderr,"%s tik17\n", __FUNCTION__);
|
//fprintf(stderr,"%s tik17\n", __FUNCTION__);
|
||||||
RegisterNodeSignals(GetNodeSignals());
|
RegisterNodeSignals(GetNodeSignals());
|
||||||
|
|
||||||
// sanitize comments per BIP-0014, format user agent and check total size
|
// sanitize comments per BIP-0014, format user agent and check total size
|
||||||
@@ -1484,7 +1486,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
return InitError(strprintf("Total length of network version string %i exceeds maximum of %i characters. Reduce the number and/or size of uacomments.",
|
return InitError(strprintf("Total length of network version string %i exceeds maximum of %i characters. Reduce the number and/or size of uacomments.",
|
||||||
strSubVersion.size(), MAX_SUBVERSION_LENGTH));
|
strSubVersion.size(), MAX_SUBVERSION_LENGTH));
|
||||||
}
|
}
|
||||||
fprintf(stderr,"%s tik18\n", __FUNCTION__);
|
//fprintf(stderr,"%s tik18\n", __FUNCTION__);
|
||||||
|
|
||||||
if (mapArgs.count("-onlynet")) {
|
if (mapArgs.count("-onlynet")) {
|
||||||
std::set<enum Network> nets;
|
std::set<enum Network> nets;
|
||||||
@@ -1501,7 +1503,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr,"%s tik19\n", __FUNCTION__);
|
//fprintf(stderr,"%s tik19\n", __FUNCTION__);
|
||||||
if (mapArgs.count("-whitelist")) {
|
if (mapArgs.count("-whitelist")) {
|
||||||
BOOST_FOREACH(const std::string& net, mapMultiArgs["-whitelist"]) {
|
BOOST_FOREACH(const std::string& net, mapMultiArgs["-whitelist"]) {
|
||||||
CSubNet subnet(net);
|
CSubNet subnet(net);
|
||||||
@@ -1527,7 +1529,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
SetNameProxy(addrProxy);
|
SetNameProxy(addrProxy);
|
||||||
SetLimited(NET_TOR, false); // by default, -proxy sets onion as reachable, unless -noonion later
|
SetLimited(NET_TOR, false); // by default, -proxy sets onion as reachable, unless -noonion later
|
||||||
}
|
}
|
||||||
fprintf(stderr,"%s tik20\n", __FUNCTION__);
|
//fprintf(stderr,"%s tik20\n", __FUNCTION__);
|
||||||
|
|
||||||
// -onion can be used to set only a proxy for .onion, or override normal proxy for .onion addresses
|
// -onion can be used to set only a proxy for .onion, or override normal proxy for .onion addresses
|
||||||
// -noonion (or -onion=0) disables connecting to .onion entirely
|
// -noonion (or -onion=0) disables connecting to .onion entirely
|
||||||
@@ -1550,7 +1552,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
fDiscover = GetBoolArg("-discover", true);
|
fDiscover = GetBoolArg("-discover", true);
|
||||||
fNameLookup = GetBoolArg("-dns", true);
|
fNameLookup = GetBoolArg("-dns", true);
|
||||||
|
|
||||||
fprintf(stderr,"%s tik22\n", __FUNCTION__);
|
//fprintf(stderr,"%s tik22\n", __FUNCTION__);
|
||||||
bool fBound = false;
|
bool fBound = false;
|
||||||
if (fListen) {
|
if (fListen) {
|
||||||
if (mapArgs.count("-bind") || mapArgs.count("-whitebind")) {
|
if (mapArgs.count("-bind") || mapArgs.count("-whitebind")) {
|
||||||
@@ -1588,7 +1590,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr,"%s tik23\n", __FUNCTION__);
|
//fprintf(stderr,"%s tik23\n", __FUNCTION__);
|
||||||
|
|
||||||
BOOST_FOREACH(const std::string& strDest, mapMultiArgs["-seednode"])
|
BOOST_FOREACH(const std::string& strDest, mapMultiArgs["-seednode"])
|
||||||
AddOneShot(strDest);
|
AddOneShot(strDest);
|
||||||
@@ -1629,7 +1631,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
return !fRequestShutdown;
|
return !fRequestShutdown;
|
||||||
}
|
}
|
||||||
// ********************************************************* Step 7: load block chain
|
// ********************************************************* Step 7: load block chain
|
||||||
fprintf(stderr,"%s tik24\n", __FUNCTION__);
|
//fprintf(stderr,"%s tik24\n", __FUNCTION__);
|
||||||
|
|
||||||
fReindex = GetBoolArg("-reindex", false);
|
fReindex = GetBoolArg("-reindex", false);
|
||||||
|
|
||||||
@@ -1861,7 +1863,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
mempool.ReadFeeEstimates(est_filein);
|
mempool.ReadFeeEstimates(est_filein);
|
||||||
fFeeEstimatesInitialized = true;
|
fFeeEstimatesInitialized = true;
|
||||||
|
|
||||||
fprintf(stderr,"%s tik25\n", __FUNCTION__);
|
//fprintf(stderr,"%s tik25\n", __FUNCTION__);
|
||||||
|
|
||||||
// ********************************************************* Step 8: load wallet
|
// ********************************************************* Step 8: load wallet
|
||||||
#ifdef ENABLE_WALLET
|
#ifdef ENABLE_WALLET
|
||||||
|
|||||||
22
src/main.cpp
22
src/main.cpp
@@ -4262,7 +4262,7 @@ static int64_t nTimePostConnect = 0;
|
|||||||
*/
|
*/
|
||||||
bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock *pblock) {
|
bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock *pblock) {
|
||||||
|
|
||||||
fprintf(stderr, "%s: Start\n", __FUNCTION__);
|
//fprintf(stderr, "%s: Start\n", __FUNCTION__);
|
||||||
assert(pindexNew->pprev == chainActive.Tip());
|
assert(pindexNew->pprev == chainActive.Tip());
|
||||||
// Read block from disk.
|
// Read block from disk.
|
||||||
int64_t nTime1 = GetTimeMicros();
|
int64_t nTime1 = GetTimeMicros();
|
||||||
@@ -4352,14 +4352,14 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock *
|
|||||||
if ( KOMODO_LONGESTCHAIN != 0 && (pindexNew->GetHeight() == KOMODO_LONGESTCHAIN || pindexNew->GetHeight() == KOMODO_LONGESTCHAIN+1) )
|
if ( KOMODO_LONGESTCHAIN != 0 && (pindexNew->GetHeight() == KOMODO_LONGESTCHAIN || pindexNew->GetHeight() == KOMODO_LONGESTCHAIN+1) )
|
||||||
KOMODO_INSYNC = (int32_t)pindexNew->GetHeight();
|
KOMODO_INSYNC = (int32_t)pindexNew->GetHeight();
|
||||||
else KOMODO_INSYNC = 0;
|
else KOMODO_INSYNC = 0;
|
||||||
fprintf(stderr,"connect.%d insync.%d ASSETCHAINS_SAPLING.%d\n",(int32_t)pindexNew->GetHeight(),KOMODO_INSYNC,ASSETCHAINS_SAPLING);
|
//fprintf(stderr,"connect.%d insync.%d ASSETCHAINS_SAPLING.%d\n",(int32_t)pindexNew->GetHeight(),KOMODO_INSYNC,ASSETCHAINS_SAPLING);
|
||||||
/*if ( KOMODO_INSYNC != 0 ) //ASSETCHAINS_SYMBOL[0] == 0 &&
|
/*if ( KOMODO_INSYNC != 0 ) //ASSETCHAINS_SYMBOL[0] == 0 &&
|
||||||
komodo_broadcast(pblock,8);
|
komodo_broadcast(pblock,8);
|
||||||
else if ( ASSETCHAINS_SYMBOL[0] != 0 )
|
else if ( ASSETCHAINS_SYMBOL[0] != 0 )
|
||||||
komodo_broadcast(pblock,4);*/
|
komodo_broadcast(pblock,4);*/
|
||||||
if ( KOMODO_NSPV_FULLNODE )
|
if ( KOMODO_NSPV_FULLNODE )
|
||||||
{
|
{
|
||||||
fprintf(stderr,"%s: KOMODO_NSPV_FULLNODE\n", __FUNCTION__);
|
//fprintf(stderr,"%s: KOMODO_NSPV_FULLNODE\n", __FUNCTION__);
|
||||||
if ( ASSETCHAINS_CBOPRET != 0 )
|
if ( ASSETCHAINS_CBOPRET != 0 )
|
||||||
komodo_pricesupdate(pindexNew->GetHeight(),pblock);
|
komodo_pricesupdate(pindexNew->GetHeight(),pblock);
|
||||||
if ( ASSETCHAINS_SAPLING <= 0 && pindexNew->nTime > KOMODO_SAPLING_ACTIVATION - 24*3600 )
|
if ( ASSETCHAINS_SAPLING <= 0 && pindexNew->nTime > KOMODO_SAPLING_ACTIVATION - 24*3600 )
|
||||||
@@ -4375,7 +4375,7 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock *
|
|||||||
fprintf(stderr, "snapshot completed in: %d seconds\n", (int32_t)(time(NULL)-start));
|
fprintf(stderr, "snapshot completed in: %d seconds\n", (int32_t)(time(NULL)-start));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fprintf(stderr,"%s: returning true\n", __FUNCTION__);
|
//fprintf(stderr,"%s: returning true\n", __FUNCTION__);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4439,12 +4439,16 @@ static CBlockIndex* FindMostWorkChain() {
|
|||||||
|
|
||||||
/** Delete all entries in setBlockIndexCandidates that are worse than the current tip. */
|
/** Delete all entries in setBlockIndexCandidates that are worse than the current tip. */
|
||||||
static void PruneBlockIndexCandidates() {
|
static void PruneBlockIndexCandidates() {
|
||||||
|
fprintf(stderr,"%s:, setBlockIndexCandidates.size=%d\n", __FUNCTION__, setBlockIndexCandidates.size() );
|
||||||
// Note that we can't delete the current block itself, as we may need to return to it later in case a
|
// Note that we can't delete the current block itself, as we may need to return to it later in case a
|
||||||
// reorganization to a better block fails.
|
// reorganization to a better block fails.
|
||||||
std::set<CBlockIndex*, CBlockIndexWorkComparator>::iterator it = setBlockIndexCandidates.begin();
|
std::set<CBlockIndex*, CBlockIndexWorkComparator>::iterator it = setBlockIndexCandidates.begin();
|
||||||
while (it != setBlockIndexCandidates.end() && setBlockIndexCandidates.value_comp()(*it, chainActive.LastTip())) {
|
while (it != setBlockIndexCandidates.end() && setBlockIndexCandidates.value_comp()(*it, chainActive.LastTip())) {
|
||||||
|
fprintf(stderr,"%s:, erasing blockindexcandidate element height=%d, time=%d\n", __FUNCTION__, (*it)->GetHeight(), (*it)->GetBlockTime() );
|
||||||
setBlockIndexCandidates.erase(it++);
|
setBlockIndexCandidates.erase(it++);
|
||||||
|
//fprintf(stderr,"%s:, erased element\n", __FUNCTION__);
|
||||||
}
|
}
|
||||||
|
fprintf(stderr,"%s:, setBlockIndexCandidates.size()=%d\n", __FUNCTION__, setBlockIndexCandidates.size() );
|
||||||
// Either the current tip or a successor of it we're working towards is left in setBlockIndexCandidates.
|
// Either the current tip or a successor of it we're working towards is left in setBlockIndexCandidates.
|
||||||
assert(!setBlockIndexCandidates.empty());
|
assert(!setBlockIndexCandidates.empty());
|
||||||
}
|
}
|
||||||
@@ -6080,9 +6084,9 @@ bool static LoadBlockIndexDB()
|
|||||||
vSortedByHeight.push_back(make_pair(pindex->GetHeight(), pindex));
|
vSortedByHeight.push_back(make_pair(pindex->GetHeight(), pindex));
|
||||||
//komodo_pindex_init(pindex,(int32_t)pindex->GetHeight());
|
//komodo_pindex_init(pindex,(int32_t)pindex->GetHeight());
|
||||||
}
|
}
|
||||||
//fprintf(stderr,"load blockindexDB paired %u\n",(uint32_t)time(NULL));
|
fprintf(stderr,"load blockindexDB paired %u\n",(uint32_t)time(NULL));
|
||||||
sort(vSortedByHeight.begin(), vSortedByHeight.end());
|
sort(vSortedByHeight.begin(), vSortedByHeight.end());
|
||||||
//fprintf(stderr,"load blockindexDB sorted %u\n",(uint32_t)time(NULL));
|
fprintf(stderr,"load blockindexDB sorted %u\n",(uint32_t)time(NULL));
|
||||||
BOOST_FOREACH(const PAIRTYPE(int, CBlockIndex*)& item, vSortedByHeight)
|
BOOST_FOREACH(const PAIRTYPE(int, CBlockIndex*)& item, vSortedByHeight)
|
||||||
{
|
{
|
||||||
CBlockIndex* pindex = item.second;
|
CBlockIndex* pindex = item.second;
|
||||||
@@ -6092,7 +6096,7 @@ bool static LoadBlockIndexDB()
|
|||||||
if (pindex->nTx > 0) {
|
if (pindex->nTx > 0) {
|
||||||
if (pindex->pprev) {
|
if (pindex->pprev) {
|
||||||
if (pindex->pprev->nChainTx) {
|
if (pindex->pprev->nChainTx) {
|
||||||
|
pindex->nChainTx = pindex->pprev->nChainTx + pindex->nTx;
|
||||||
if (pindex->pprev->nChainSproutValue && pindex->nSproutValue) {
|
if (pindex->pprev->nChainSproutValue && pindex->nSproutValue) {
|
||||||
pindex->nChainSproutValue = *pindex->pprev->nChainSproutValue + *pindex->nSproutValue;
|
pindex->nChainSproutValue = *pindex->pprev->nChainSproutValue + *pindex->nSproutValue;
|
||||||
} else {
|
} else {
|
||||||
@@ -6138,7 +6142,7 @@ bool static LoadBlockIndexDB()
|
|||||||
pindexBestHeader = pindex;
|
pindexBestHeader = pindex;
|
||||||
//komodo_pindex_init(pindex,(int32_t)pindex->GetHeight());
|
//komodo_pindex_init(pindex,(int32_t)pindex->GetHeight());
|
||||||
}
|
}
|
||||||
//fprintf(stderr,"load blockindexDB chained %u\n",(uint32_t)time(NULL));
|
fprintf(stderr,"load blockindexDB chained %u\n",(uint32_t)time(NULL));
|
||||||
|
|
||||||
// Load block file info
|
// Load block file info
|
||||||
pblocktree->ReadLastBlockFile(nLastBlockFile);
|
pblocktree->ReadLastBlockFile(nLastBlockFile);
|
||||||
@@ -6232,6 +6236,8 @@ bool static LoadBlockIndexDB()
|
|||||||
// Set hashFinalSproutRoot for the end of best chain
|
// Set hashFinalSproutRoot for the end of best chain
|
||||||
it->second->hashFinalSproutRoot = pcoinsTip->GetBestAnchor(SPROUT);
|
it->second->hashFinalSproutRoot = pcoinsTip->GetBestAnchor(SPROUT);
|
||||||
|
|
||||||
|
fprintf(stderr,"about to prune block index\n");
|
||||||
|
|
||||||
PruneBlockIndexCandidates();
|
PruneBlockIndexCandidates();
|
||||||
|
|
||||||
double progress;
|
double progress;
|
||||||
|
|||||||
Reference in New Issue
Block a user