GoLowCrypto on Nostr: 🔑💰 int AppInit(int argc, char* argv[]) { const auto defaultBaseParams = ...
🔑💰
int AppInit(int argc, char* argv[])
{
const auto defaultBaseParams = CreateBaseChainParams(CBaseChainParams::MAIN);
const auto testnetBaseParams = CreateBaseChainParams(CBaseChainParams::TESTNET);
const auto defaultChainParams = CreateChainParams(CBaseChainParams::MAIN);
const auto testnetChainParams = CreateChainParams(CBaseChainParams::TESTNET);
const auto& fHelp = gArgs.GetBoolArg("-help", false);
const auto& fVersion = gArgs.GetBoolArg("-version", false);
auto chainParams = defaultChainParams;
auto baseParams = defaultBaseParams;
// SIP-37 Special upgrade block.
bool fSpecialUpgrade = false;
if (!fHelp) {
if (!gArgs.GetBoolArg("-special-upgrade", false)) {
for (int i = 0; i < argc; i++) {
std::string str = argv[i];
if (str == "-special-upgrade") {
fSpecialUpgrade = true;
break;
}
}
} else {
fSpecialUpgrade = true;
}
}
SetupEnvironment();
if (!SetupNetworking()) {
return InitError("Initializing networking failed");
}
if (fHelp) {
return HandleHelp(chainParams);
}
if (fVersion) {
return HandleVersion();
}
if (fSpecialUpgrade) {
return HandleSpecialUpgrade();
}
// Parse parameters
if (!gArgs.ParseParameters(argc, argv, chainParams)) {
return InitError(strprintf("Invalid command line arguments: net.version=%d, strSubVersion=%s\n",
chainParams->GetNetMagic(), chainParams->GetNetwork().c_str()));
}
if (!SelectBaseParamsFromCommandLine()) {
return false;
}
if (gArgs.GetBoolArg("-printblockindex", false) || gArgs.GetBoolArg("-printblocktree", false)) {
return HandlePrintBlockIndex(baseParams);
}
if (gArgs.GetArg("-blocknotify", "").empty()) {
gArgs.ForceRemoveArg("-blocknotify");
}
// Error out when loose non-argument tokens are encountered on command line
if (gArgs.IsArgName("-loose-")) {
return InitError("Error: Unsupported argument -loose-...");
}
// Error out when unknown non-argument tokens are encountered on command line
if (gArgs.IsArgName("-unknown-")) {
return InitError("Error: Unknown argument -unknown-... see help for options");
}
if (!fs::is_directory(GetDataDir(false))) {
return InitError(strprintf("Error: Specified data directory \"%s\" does not exist.", gArgs.GetArg("-
int AppInit(int argc, char* argv[])
{
const auto defaultBaseParams = CreateBaseChainParams(CBaseChainParams::MAIN);
const auto testnetBaseParams = CreateBaseChainParams(CBaseChainParams::TESTNET);
const auto defaultChainParams = CreateChainParams(CBaseChainParams::MAIN);
const auto testnetChainParams = CreateChainParams(CBaseChainParams::TESTNET);
const auto& fHelp = gArgs.GetBoolArg("-help", false);
const auto& fVersion = gArgs.GetBoolArg("-version", false);
auto chainParams = defaultChainParams;
auto baseParams = defaultBaseParams;
// SIP-37 Special upgrade block.
bool fSpecialUpgrade = false;
if (!fHelp) {
if (!gArgs.GetBoolArg("-special-upgrade", false)) {
for (int i = 0; i < argc; i++) {
std::string str = argv[i];
if (str == "-special-upgrade") {
fSpecialUpgrade = true;
break;
}
}
} else {
fSpecialUpgrade = true;
}
}
SetupEnvironment();
if (!SetupNetworking()) {
return InitError("Initializing networking failed");
}
if (fHelp) {
return HandleHelp(chainParams);
}
if (fVersion) {
return HandleVersion();
}
if (fSpecialUpgrade) {
return HandleSpecialUpgrade();
}
// Parse parameters
if (!gArgs.ParseParameters(argc, argv, chainParams)) {
return InitError(strprintf("Invalid command line arguments: net.version=%d, strSubVersion=%s\n",
chainParams->GetNetMagic(), chainParams->GetNetwork().c_str()));
}
if (!SelectBaseParamsFromCommandLine()) {
return false;
}
if (gArgs.GetBoolArg("-printblockindex", false) || gArgs.GetBoolArg("-printblocktree", false)) {
return HandlePrintBlockIndex(baseParams);
}
if (gArgs.GetArg("-blocknotify", "").empty()) {
gArgs.ForceRemoveArg("-blocknotify");
}
// Error out when loose non-argument tokens are encountered on command line
if (gArgs.IsArgName("-loose-")) {
return InitError("Error: Unsupported argument -loose-...");
}
// Error out when unknown non-argument tokens are encountered on command line
if (gArgs.IsArgName("-unknown-")) {
return InitError("Error: Unknown argument -unknown-... see help for options");
}
if (!fs::is_directory(GetDataDir(false))) {
return InitError(strprintf("Error: Specified data directory \"%s\" does not exist.", gArgs.GetArg("-