Skip to content
Permalink
Browse files

Merge 7eb863e into 6e6b859

  • Loading branch information...
hebasto committed Feb 2, 2019
2 parents 6e6b859 + 7eb863e commit fde2cad040cb4bce3b270dcd31122a213107da88
Showing with 50 additions and 51 deletions.
  1. +23 −24 src/init.cpp
  2. +12 −12 src/wallet/init.cpp
  3. +15 −15 src/wallet/wallet.cpp
@@ -714,15 +714,15 @@ static void ThreadImport(std::vector<fs::path> vImportFiles)
static bool InitSanityCheck()
{
if(!ECC_InitSanityCheck()) {
InitError("Elliptic curve cryptography sanity check failure. Aborting.");
InitError(_("Elliptic curve cryptography sanity check failure. Aborting."));
return false;
}

if (!glibc_sanity_test() || !glibcxx_sanity_test())
return false;

if (!Random_SanityCheck()) {
InitError("OS cryptographic RNG sanity check failure. Aborting.");
InitError(_("OS cryptographic RNG sanity check failure. Aborting."));
return false;
}

@@ -904,7 +904,7 @@ bool AppInitBasicSetup()
#endif

if (!SetupNetworking())
return InitError("Initializing networking failed");
return InitError(_("Initializing networking failed"));

#ifndef WIN32
if (!gArgs.GetBoolArg("-sysperms", false)) {
@@ -943,13 +943,13 @@ bool AppInitParameterInteraction()
// if using block pruning, then disallow txindex
if (gArgs.GetArg("-prune", 0)) {
if (gArgs.GetBoolArg("-txindex", DEFAULT_TXINDEX))
return InitError(_("Prune mode is incompatible with -txindex."));
return InitError(strprintf(_("Prune mode is incompatible with %s."), "-txindex"));
}

// -bind and -whitebind can't be set when not listening
size_t nUserBind = gArgs.GetArgs("-bind").size() + gArgs.GetArgs("-whitebind").size();
if (nUserBind != 0 && !gArgs.GetBoolArg("-listen", DEFAULT_LISTEN)) {
return InitError("Cannot set -bind or -whitebind together with -listen=0");
return InitError(strprintf(_("Cannot set %s or %s together with %s=0"), "-bind", "-whitebind", "-listen"));
}

// Make sure enough file descriptors are available
@@ -971,7 +971,7 @@ bool AppInitParameterInteraction()
nMaxConnections = std::min(nFD - MIN_CORE_FILEDESCRIPTORS - MAX_ADDNODE_CONNECTIONS, nMaxConnections);

if (nMaxConnections < nUserMaxConnections)
InitWarning(strprintf(_("Reducing -maxconnections from %d to %d, because of system limitations."), nUserMaxConnections, nMaxConnections));
InitWarning(strprintf(_("Reducing %s from %d to %d, because of system limitations."), "-maxconnections", nUserMaxConnections, nMaxConnections));

// ********************************************************* Step 3: parameter-to-internal-flags
if (gArgs.IsArgSet("-debug")) {
@@ -1012,7 +1012,7 @@ bool AppInitParameterInteraction()
if (gArgs.IsArgSet("-minimumchainwork")) {
const std::string minChainWorkStr = gArgs.GetArg("-minimumchainwork", "");
if (!IsHexNumber(minChainWorkStr)) {
return InitError(strprintf("Invalid non-hex (%s) minimum chain work value specified", minChainWorkStr));
return InitError(strprintf(_("Invalid non-hex (%s) minimum chain work value specified"), minChainWorkStr));
}
nMinimumChainWork = UintToArith256(uint256S(minChainWorkStr));
} else {
@@ -1027,7 +1027,7 @@ bool AppInitParameterInteraction()
int64_t nMempoolSizeMax = gArgs.GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000;
int64_t nMempoolSizeMin = gArgs.GetArg("-limitdescendantsize", DEFAULT_DESCENDANT_SIZE_LIMIT) * 1000 * 40;
if (nMempoolSizeMax < 0 || nMempoolSizeMax < nMempoolSizeMin)
return InitError(strprintf(_("-maxmempool must be at least %d MB"), std::ceil(nMempoolSizeMin / 1000000.0)));
return InitError(strprintf(_("%s must be at least %d MB"), "-maxmempool", std::ceil(nMempoolSizeMin / 1000000.0)));
// incremental relay fee sets the minimum feerate increase necessary for BIP 125 replacement in the mempool
// and the amount the mempool min fee increases above the feerate of txs evicted due to mempool limiting.
if (gArgs.IsArgSet("-incrementalrelayfee"))
@@ -1072,7 +1072,7 @@ bool AppInitParameterInteraction()

peer_connect_timeout = gArgs.GetArg("-peertimeout", DEFAULT_PEER_CONNECT_TIMEOUT);
if (peer_connect_timeout <= 0) {
return InitError("peertimeout cannot be configured with a negative value.");
return InitError(strprintf(_("%s cannot be configured with a negative value."), "-peertimeout"));
}

if (gArgs.IsArgSet("-minrelaytxfee")) {
@@ -1109,7 +1109,7 @@ bool AppInitParameterInteraction()

fRequireStandard = !gArgs.GetBoolArg("-acceptnonstdtxn", !chainparams.RequireStandard());
if (chainparams.RequireStandard() && !fRequireStandard)
return InitError(strprintf("acceptnonstdtxn is not currently supported for %s chain", chainparams.NetworkIDString()));
return InitError(strprintf(_("%s is not currently supported for %s chain"), "-acceptnonstdtxn", chainparams.NetworkIDString()));
nBytesPerSigOp = gArgs.GetArg("-bytespersigop", nBytesPerSigOp);

if (!g_wallet_init_interface.ParameterInteraction()) return false;
@@ -1125,10 +1125,10 @@ bool AppInitParameterInteraction()
nLocalServices = ServiceFlags(nLocalServices | NODE_BLOOM);

if (gArgs.GetArg("-rpcserialversion", DEFAULT_RPC_SERIALIZE_VERSION) < 0)
return InitError("rpcserialversion must be non-negative.");
return InitError(strprintf(_("%s must be non-negative."), "-rpcserialversion"));

if (gArgs.GetArg("-rpcserialversion", DEFAULT_RPC_SERIALIZE_VERSION) > 1)
return InitError("unknown rpcserialversion requested.");
return InitError(strprintf(_("Unknown %s requested."), "-rpcserialversion"));

nMaxTipAge = gArgs.GetArg("-maxtipage", DEFAULT_MAX_TIP_AGE);

@@ -1204,8 +1204,7 @@ bool AppInitMain(InitInterfaces& interfaces)
g_logger->ShrinkDebugFile();
}
if (!g_logger->OpenDebugLog()) {
return InitError(strprintf("Could not open debug log file %s",
g_logger->m_file_path.string()));
return InitError(strprintf(_("Could not open debug log file %s"), g_logger->m_file_path.string()));
}
}

@@ -1322,7 +1321,7 @@ bool AppInitMain(InitInterfaces& interfaces)
for (const std::string& snet : gArgs.GetArgs("-onlynet")) {
enum Network net = ParseNetwork(snet);
if (net == NET_UNROUTABLE)
return InitError(strprintf(_("Unknown network specified in -onlynet: '%s'"), snet));
return InitError(strprintf(_("Unknown network specified in %s: '%s'"), "-onlynet", snet));
nets.insert(net);
}
for (int n = 0; n < NET_MAX; n++) {
@@ -1343,12 +1342,12 @@ bool AppInitMain(InitInterfaces& interfaces)
if (proxyArg != "" && proxyArg != "0") {
CService proxyAddr;
if (!Lookup(proxyArg.c_str(), proxyAddr, 9050, fNameLookup)) {
return InitError(strprintf(_("Invalid -proxy address or hostname: '%s'"), proxyArg));
return InitError(strprintf(_("Invalid %s address or hostname: '%s'"), "-proxy", proxyArg));
}

proxyType addrProxy = proxyType(proxyAddr, proxyRandomize);
if (!addrProxy.IsValid())
return InitError(strprintf(_("Invalid -proxy address or hostname: '%s'"), proxyArg));
return InitError(strprintf(_("Invalid %s address or hostname: '%s'"), "-proxy", proxyArg));

SetProxy(NET_IPV4, addrProxy);
SetProxy(NET_IPV6, addrProxy);
@@ -1367,11 +1366,11 @@ bool AppInitMain(InitInterfaces& interfaces)
} else {
CService onionProxy;
if (!Lookup(onionArg.c_str(), onionProxy, 9050, fNameLookup)) {
return InitError(strprintf(_("Invalid -onion address or hostname: '%s'"), onionArg));
return InitError(strprintf(_("Invalid %s address or hostname: '%s'"), "-onion", onionArg));
}
proxyType addrOnion = proxyType(onionProxy, proxyRandomize);
if (!addrOnion.IsValid())
return InitError(strprintf(_("Invalid -onion address or hostname: '%s'"), onionArg));
return InitError(strprintf(_("Invalid %s address or hostname: '%s'"), "-onion", onionArg));
SetProxy(NET_ONION, addrOnion);
SetReachable(NET_ONION, true);
}
@@ -1478,7 +1477,7 @@ bool AppInitMain(InitInterfaces& interfaces)
// 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) {
strLoadError = _("You need to rebuild the database using -reindex to go back to unpruned mode. This will redownload the entire blockchain");
strLoadError = strprintf(_("You need to rebuild the database using %s to go back to unpruned mode. This will redownload the entire blockchain"), "-reindex");
break;
}

@@ -1506,7 +1505,7 @@ bool AppInitMain(InitInterfaces& interfaces)

// ReplayBlocks is a no-op if we cleared the coinsviewdb with -reindex or -reindex-chainstate
if (!ReplayBlocks(chainparams, pcoinsdbview.get())) {
strLoadError = _("Unable to replay blocks. You will need to rebuild the database using -reindex-chainstate.");
strLoadError = strprintf(_("Unable to replay blocks. You will need to rebuild the database using %s."), "-reindex-chainstate");
break;
}

@@ -1571,7 +1570,7 @@ bool AppInitMain(InitInterfaces& interfaces)
if (!fReset) {
bool fRet = uiInterface.ThreadSafeQuestion(
strLoadError + ".\n\n" + _("Do you want to rebuild the block database now?"),
strLoadError + ".\nPlease restart with -reindex or -reindex-chainstate to recover.",
strLoadError + ".\n" + strprintf(_("Please restart with %s or %s to recover."), "-reindex", "-reindex-chainstate"),
"", CClientUIInterface::MSG_ERROR | CClientUIInterface::BTN_ABORT);
if (fRet) {
fReindex = true;
@@ -1734,7 +1733,7 @@ bool AppInitMain(InitInterfaces& interfaces)
return InitError(ResolveErrMsg("whitebind", strBind));
}
if (addrBind.GetPort() == 0) {
return InitError(strprintf(_("Need to specify a port with -whitebind: '%s'"), strBind));
return InitError(strprintf(_("Need to specify a port with %s: '%s'"), "-whitebind", strBind));
}
connOptions.vWhiteBinds.push_back(addrBind);
}
@@ -1743,7 +1742,7 @@ bool AppInitMain(InitInterfaces& interfaces)
CSubNet subnet;
LookupSubNet(net.c_str(), subnet);
if (!subnet.IsValid())
return InitError(strprintf(_("Invalid netmask specified in -whitelist: '%s'"), net));
return InitError(strprintf(_("Invalid netmask specified in %s: '%s'"), "-whitelist", net));
connOptions.vWhitelistedRange.push_back(subnet);
}

@@ -88,7 +88,7 @@ bool WalletInit::ParameterInteraction() const

if (gArgs.GetBoolArg("-salvagewallet", false)) {
if (is_multiwallet) {
return InitError(strprintf("%s is only allowed with a single wallet file", "-salvagewallet"));
return InitError(strprintf(_("%s is only allowed with a single wallet file"), "-salvagewallet"));
}
// Rewrite just private keys: rescan to find transactions
if (gArgs.SoftSetBoolArg("-rescan", true)) {
@@ -105,7 +105,7 @@ bool WalletInit::ParameterInteraction() const
// -zapwallettxes implies a rescan
if (zapwallettxes) {
if (is_multiwallet) {
return InitError(strprintf("%s is only allowed with a single wallet file", "-zapwallettxes"));
return InitError(strprintf(_("%s is only allowed with a single wallet file"), "-zapwallettxes"));
}
if (gArgs.SoftSetBoolArg("-rescan", true)) {
LogPrintf("%s: parameter interaction: -zapwallettxes enabled -> setting -rescan=1\n", __func__);
@@ -114,14 +114,14 @@ bool WalletInit::ParameterInteraction() const

if (is_multiwallet) {
if (gArgs.GetBoolArg("-upgradewallet", false)) {
return InitError(strprintf("%s is only allowed with a single wallet file", "-upgradewallet"));
return InitError(strprintf(_("%s is only allowed with a single wallet file"), "-upgradewallet"));
}
}

if (gArgs.GetBoolArg("-sysperms", false))
return InitError("-sysperms is not allowed in combination with enabled wallet functionality");
return InitError(strprintf(_("%s is not allowed in combination with enabled wallet functionality"), "-sysperms"));
if (gArgs.GetArg("-prune", 0) && gArgs.GetBoolArg("-rescan", false))
return InitError(_("Rescans are not possible in pruned mode. You will need to use -reindex which will download the whole blockchain again."));
return InitError(strprintf(_("Rescans are not possible in pruned mode. You will need to use %s which will download the whole blockchain again."), "-reindex"));

if (::minRelayTxFee.GetFeePerK() > HIGH_TX_FEE_PER_KB)
InitWarning(AmountHighWarn("-minrelaytxfee") + " " +
@@ -133,12 +133,12 @@ bool WalletInit::ParameterInteraction() const
if (!ParseMoney(gArgs.GetArg("-maxtxfee", ""), nMaxFee))
return InitError(AmountErrMsg("maxtxfee", gArgs.GetArg("-maxtxfee", "")));
if (nMaxFee > HIGH_MAX_TX_FEE)
InitWarning(_("-maxtxfee is set very high! Fees this large could be paid on a single transaction."));
InitWarning(strprintf(_("%s is set very high! Fees this large could be paid on a single transaction."), "-maxtxfee"));
maxTxFee = nMaxFee;
if (CFeeRate(maxTxFee, 1000) < ::minRelayTxFee)
{
return InitError(strprintf(_("Invalid amount for -maxtxfee=<amount>: '%s' (must be at least the minrelay fee of %s to prevent stuck transactions)"),
gArgs.GetArg("-maxtxfee", ""), ::minRelayTxFee.ToString()));
return InitError(strprintf(_("Invalid amount for %s=<amount>: '%s' (must be at least the minimum relay fee of %s to prevent stuck transactions)"),
"-maxtxfee", gArgs.GetArg("-maxtxfee", ""), ::minRelayTxFee.ToString()));
}
}

@@ -153,12 +153,12 @@ bool VerifyWallets(interfaces::Chain& chain, const std::vector<std::string>& wal
// The canonical path cleans the path, preventing >1 Berkeley environment instances for the same directory
fs::path canonical_wallet_dir = fs::canonical(wallet_dir, error);
if (error || !fs::exists(wallet_dir)) {
return InitError(strprintf(_("Specified -walletdir \"%s\" does not exist"), wallet_dir.string()));
return InitError(strprintf(_("Specified %s \"%s\" does not exist"), "-walletdir", wallet_dir.string()));
} else if (!fs::is_directory(wallet_dir)) {
return InitError(strprintf(_("Specified -walletdir \"%s\" is not a directory"), wallet_dir.string()));
return InitError(strprintf(_("Specified %s \"%s\" is not a directory"), "-walletdir", wallet_dir.string()));
// The canonical path transforms relative paths into absolute ones, so we check the non-canonical version
} else if (!wallet_dir.is_absolute()) {
return InitError(strprintf(_("Specified -walletdir \"%s\" is a relative path"), wallet_dir.string()));
return InitError(strprintf(_("Specified %s \"%s\" is a relative path"), "-walletdir", wallet_dir.string()));
}
gArgs.ForceSetArg("-walletdir", canonical_wallet_dir.string());
}
@@ -179,7 +179,7 @@ bool VerifyWallets(interfaces::Chain& chain, const std::vector<std::string>& wal
WalletLocation location(wallet_file);

if (!wallet_paths.insert(location.GetPath()).second) {
return InitError(strprintf(_("Error loading wallet %s. Duplicate -wallet filename specified."), wallet_file));
return InitError(strprintf(_("Error loading wallet %s. Duplicate %s filename specified."), wallet_file, "-wallet"));
}

std::string error_string;

0 comments on commit fde2cad

Please sign in to comment.
You can’t perform that action at this time.