Merge pull request #27 from MyHush/ztxstats

Add shielded stats to getchaintxstats via zindex
This commit is contained in:
Duke Leto
2019-08-22 08:19:06 -04:00
committed by GitHub
6 changed files with 405 additions and 41 deletions

View File

@@ -400,6 +400,7 @@ std::string HelpMessage(HelpMessageMode mode)
strUsage += HelpMessageOpt("-addressindex", strprintf(_("Maintain a full address index, used to query for the balance, txids and unspent outputs for addresses (default: %u)"), DEFAULT_ADDRESSINDEX));
strUsage += HelpMessageOpt("-timestampindex", strprintf(_("Maintain a timestamp index for block hashes, used to query blocks hashes by a range of timestamps (default: %u)"), DEFAULT_TIMESTAMPINDEX));
strUsage += HelpMessageOpt("-spentindex", strprintf(_("Maintain a full spent index, used to query the spending txid and input index for an outpoint (default: %u)"), DEFAULT_SPENTINDEX));
strUsage += HelpMessageOpt("-zindex", strprintf(_("Maintain extra statistics about shielded transactions and payments (default: %u)"), 0));
strUsage += HelpMessageGroup(_("Connection options:"));
strUsage += HelpMessageOpt("-addnode=<ip>", _("Add a node to connect to and attempt to keep the connection open"));
strUsage += HelpMessageOpt("-banscore=<n>", strprintf(_("Threshold for disconnecting misbehaving peers (default: %u)"), 100));
@@ -1282,14 +1283,11 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
return InitError(strprintf(_("Cannot obtain a lock on data directory %s. Komodo is probably already running.") + " %s.", strDataDir, e.what()));
}
fprintf(stderr,"About to create pidfile\n");
#ifndef _WIN32
CreatePidFile(GetPidFile(), getpid());
#endif
fprintf(stderr,"created pidfile\n");
if (GetBoolArg("-shrinkdebugfile", !fDebug))
ShrinkDebugFile();
fprintf(stderr,"past shrinkdebugfile\n");
LogPrintf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
LogPrintf("Komodo version %s (%s)\n", FormatFullVersion(), CLIENT_DATE);
@@ -1668,6 +1666,12 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
break;
}
fprintf(stderr, "zindex=%s in block index\n", fZindex ? "enabled" : "disabled");
if (fZindex != GetBoolArg("-zindex", false)) {
strLoadError = _("You need to rebuild the database using -reindex to change -zindex");
break;
}
// Check for changed -prune state. What we are concerned about is a user who has pruned blocks
// in the past, but is now trying to run unpruned.
if (fHavePruned && !fPruneMode) {