mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-12 02:07:39 +01:00
Make InitError bilingual
This commit is contained in:
parent
917ca93553
commit
7e923d47ba
9 changed files with 74 additions and 73 deletions
|
@ -56,7 +56,7 @@ static bool AppInit(int argc, char* argv[])
|
||||||
SetupServerArgs(node);
|
SetupServerArgs(node);
|
||||||
std::string error;
|
std::string error;
|
||||||
if (!gArgs.ParseParameters(argc, argv, error)) {
|
if (!gArgs.ParseParameters(argc, argv, error)) {
|
||||||
return InitError(strprintf("Error parsing command line arguments: %s\n", error));
|
return InitError(Untranslated(strprintf("Error parsing command line arguments: %s\n", error)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process help and version before taking care about datadir
|
// Process help and version before taking care about datadir
|
||||||
|
@ -80,22 +80,22 @@ static bool AppInit(int argc, char* argv[])
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!CheckDataDirOption()) {
|
if (!CheckDataDirOption()) {
|
||||||
return InitError(strprintf("Specified data directory \"%s\" does not exist.\n", gArgs.GetArg("-datadir", "")));
|
return InitError(Untranslated(strprintf("Specified data directory \"%s\" does not exist.\n", gArgs.GetArg("-datadir", ""))));
|
||||||
}
|
}
|
||||||
if (!gArgs.ReadConfigFiles(error, true)) {
|
if (!gArgs.ReadConfigFiles(error, true)) {
|
||||||
return InitError(strprintf("Error reading configuration file: %s\n", error));
|
return InitError(Untranslated(strprintf("Error reading configuration file: %s\n", error)));
|
||||||
}
|
}
|
||||||
// Check for -chain, -testnet or -regtest parameter (Params() calls are only valid after this clause)
|
// Check for -chain, -testnet or -regtest parameter (Params() calls are only valid after this clause)
|
||||||
try {
|
try {
|
||||||
SelectParams(gArgs.GetChainName());
|
SelectParams(gArgs.GetChainName());
|
||||||
} catch (const std::exception& e) {
|
} catch (const std::exception& e) {
|
||||||
return InitError(strprintf("%s\n", e.what()));
|
return InitError(Untranslated(strprintf("%s\n", e.what())));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Error out when loose non-argument tokens are encountered on command line
|
// Error out when loose non-argument tokens are encountered on command line
|
||||||
for (int i = 1; i < argc; i++) {
|
for (int i = 1; i < argc; i++) {
|
||||||
if (!IsSwitchChar(argv[i][0])) {
|
if (!IsSwitchChar(argv[i][0])) {
|
||||||
return InitError(strprintf("Command line contains unexpected token '%s', see bitcoind -h for a list of options.\n", argv[i]));
|
return InitError(Untranslated(strprintf("Command line contains unexpected token '%s', see bitcoind -h for a list of options.\n", argv[i])));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,13 +130,13 @@ static bool AppInit(int argc, char* argv[])
|
||||||
|
|
||||||
// Daemonize
|
// Daemonize
|
||||||
if (daemon(1, 0)) { // don't chdir (1), do close FDs (0)
|
if (daemon(1, 0)) { // don't chdir (1), do close FDs (0)
|
||||||
return InitError(strprintf("daemon() failed: %s\n", strerror(errno)));
|
return InitError(Untranslated(strprintf("daemon() failed: %s\n", strerror(errno))));
|
||||||
}
|
}
|
||||||
#if defined(MAC_OSX)
|
#if defined(MAC_OSX)
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
return InitError("-daemon is not supported on this operating system\n");
|
return InitError(Untranslated("-daemon is not supported on this operating system\n"));
|
||||||
#endif // HAVE_DECL_DAEMON
|
#endif // HAVE_DECL_DAEMON
|
||||||
}
|
}
|
||||||
// Lock data directory after daemonization
|
// Lock data directory after daemonization
|
||||||
|
|
97
src/init.cpp
97
src/init.cpp
|
@ -121,7 +121,7 @@ NODISCARD static bool CreatePidFile()
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return InitError(strprintf(_("Unable to create the PID file '%s': %s").translated, GetPidFile().string(), std::strerror(errno)));
|
return InitError(strprintf(_("Unable to create the PID file '%s': %s"), GetPidFile().string(), std::strerror(errno)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -768,17 +768,15 @@ static void ThreadImport(std::vector<fs::path> vImportFiles)
|
||||||
*/
|
*/
|
||||||
static bool InitSanityCheck()
|
static bool InitSanityCheck()
|
||||||
{
|
{
|
||||||
if(!ECC_InitSanityCheck()) {
|
if (!ECC_InitSanityCheck()) {
|
||||||
InitError("Elliptic curve cryptography sanity check failure. Aborting.");
|
return InitError(Untranslated("Elliptic curve cryptography sanity check failure. Aborting."));
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!glibc_sanity_test() || !glibcxx_sanity_test())
|
if (!glibc_sanity_test() || !glibcxx_sanity_test())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!Random_SanityCheck()) {
|
if (!Random_SanityCheck()) {
|
||||||
InitError("OS cryptographic RNG sanity check failure. Aborting.");
|
return InitError(Untranslated("OS cryptographic RNG sanity check failure. Aborting."));
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -929,8 +927,9 @@ bool AppInitBasicSetup()
|
||||||
HeapSetInformation(nullptr, HeapEnableTerminationOnCorruption, nullptr, 0);
|
HeapSetInformation(nullptr, HeapEnableTerminationOnCorruption, nullptr, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!SetupNetworking())
|
if (!SetupNetworking()) {
|
||||||
return InitError("Initializing networking failed");
|
return InitError(Untranslated("Initializing networking failed."));
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
if (!gArgs.GetBoolArg("-sysperms", false)) {
|
if (!gArgs.GetBoolArg("-sysperms", false)) {
|
||||||
|
@ -967,7 +966,7 @@ bool AppInitParameterInteraction()
|
||||||
// on the command line or in this network's section of the config file.
|
// on the command line or in this network's section of the config file.
|
||||||
std::string network = gArgs.GetChainName();
|
std::string network = gArgs.GetChainName();
|
||||||
for (const auto& arg : gArgs.GetUnsuitableSectionOnlyArgs()) {
|
for (const auto& arg : gArgs.GetUnsuitableSectionOnlyArgs()) {
|
||||||
return InitError(strprintf(_("Config setting for %s only applied on %s network when in [%s] section.").translated, arg, network, network));
|
return InitError(strprintf(_("Config setting for %s only applied on %s network when in [%s] section."), arg, network, network));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warn if unrecognized section name are present in the config file.
|
// Warn if unrecognized section name are present in the config file.
|
||||||
|
@ -976,7 +975,7 @@ bool AppInitParameterInteraction()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fs::is_directory(GetBlocksDir())) {
|
if (!fs::is_directory(GetBlocksDir())) {
|
||||||
return InitError(strprintf(_("Specified blocks directory \"%s\" does not exist.").translated, gArgs.GetArg("-blocksdir", "")));
|
return InitError(strprintf(_("Specified blocks directory \"%s\" does not exist."), gArgs.GetArg("-blocksdir", "")));
|
||||||
}
|
}
|
||||||
|
|
||||||
// parse and validate enabled filter types
|
// parse and validate enabled filter types
|
||||||
|
@ -988,7 +987,7 @@ bool AppInitParameterInteraction()
|
||||||
for (const auto& name : names) {
|
for (const auto& name : names) {
|
||||||
BlockFilterType filter_type;
|
BlockFilterType filter_type;
|
||||||
if (!BlockFilterTypeByName(name, filter_type)) {
|
if (!BlockFilterTypeByName(name, filter_type)) {
|
||||||
return InitError(strprintf(_("Unknown -blockfilterindex value %s.").translated, name));
|
return InitError(strprintf(_("Unknown -blockfilterindex value %s."), name));
|
||||||
}
|
}
|
||||||
g_enabled_filter_types.insert(filter_type);
|
g_enabled_filter_types.insert(filter_type);
|
||||||
}
|
}
|
||||||
|
@ -997,16 +996,16 @@ bool AppInitParameterInteraction()
|
||||||
// if using block pruning, then disallow txindex
|
// if using block pruning, then disallow txindex
|
||||||
if (gArgs.GetArg("-prune", 0)) {
|
if (gArgs.GetArg("-prune", 0)) {
|
||||||
if (gArgs.GetBoolArg("-txindex", DEFAULT_TXINDEX))
|
if (gArgs.GetBoolArg("-txindex", DEFAULT_TXINDEX))
|
||||||
return InitError(_("Prune mode is incompatible with -txindex.").translated);
|
return InitError(_("Prune mode is incompatible with -txindex."));
|
||||||
if (!g_enabled_filter_types.empty()) {
|
if (!g_enabled_filter_types.empty()) {
|
||||||
return InitError(_("Prune mode is incompatible with -blockfilterindex.").translated);
|
return InitError(_("Prune mode is incompatible with -blockfilterindex."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// -bind and -whitebind can't be set when not listening
|
// -bind and -whitebind can't be set when not listening
|
||||||
size_t nUserBind = gArgs.GetArgs("-bind").size() + gArgs.GetArgs("-whitebind").size();
|
size_t nUserBind = gArgs.GetArgs("-bind").size() + gArgs.GetArgs("-whitebind").size();
|
||||||
if (nUserBind != 0 && !gArgs.GetBoolArg("-listen", DEFAULT_LISTEN)) {
|
if (nUserBind != 0 && !gArgs.GetBoolArg("-listen", DEFAULT_LISTEN)) {
|
||||||
return InitError("Cannot set -bind or -whitebind together with -listen=0");
|
return InitError(Untranslated("Cannot set -bind or -whitebind together with -listen=0"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure enough file descriptors are available
|
// Make sure enough file descriptors are available
|
||||||
|
@ -1024,7 +1023,7 @@ bool AppInitParameterInteraction()
|
||||||
#endif
|
#endif
|
||||||
nMaxConnections = std::max(std::min<int>(nMaxConnections, fd_max - nBind - MIN_CORE_FILEDESCRIPTORS - MAX_ADDNODE_CONNECTIONS), 0);
|
nMaxConnections = std::max(std::min<int>(nMaxConnections, fd_max - nBind - MIN_CORE_FILEDESCRIPTORS - MAX_ADDNODE_CONNECTIONS), 0);
|
||||||
if (nFD < MIN_CORE_FILEDESCRIPTORS)
|
if (nFD < MIN_CORE_FILEDESCRIPTORS)
|
||||||
return InitError(_("Not enough file descriptors available.").translated);
|
return InitError(_("Not enough file descriptors available."));
|
||||||
nMaxConnections = std::min(nFD - MIN_CORE_FILEDESCRIPTORS - MAX_ADDNODE_CONNECTIONS, nMaxConnections);
|
nMaxConnections = std::min(nFD - MIN_CORE_FILEDESCRIPTORS - MAX_ADDNODE_CONNECTIONS, nMaxConnections);
|
||||||
|
|
||||||
if (nMaxConnections < nUserMaxConnections)
|
if (nMaxConnections < nUserMaxConnections)
|
||||||
|
@ -1069,7 +1068,7 @@ bool AppInitParameterInteraction()
|
||||||
if (gArgs.IsArgSet("-minimumchainwork")) {
|
if (gArgs.IsArgSet("-minimumchainwork")) {
|
||||||
const std::string minChainWorkStr = gArgs.GetArg("-minimumchainwork", "");
|
const std::string minChainWorkStr = gArgs.GetArg("-minimumchainwork", "");
|
||||||
if (!IsHexNumber(minChainWorkStr)) {
|
if (!IsHexNumber(minChainWorkStr)) {
|
||||||
return InitError(strprintf("Invalid non-hex (%s) minimum chain work value specified", minChainWorkStr));
|
return InitError(strprintf(Untranslated("Invalid non-hex (%s) minimum chain work value specified"), minChainWorkStr));
|
||||||
}
|
}
|
||||||
nMinimumChainWork = UintToArith256(uint256S(minChainWorkStr));
|
nMinimumChainWork = UintToArith256(uint256S(minChainWorkStr));
|
||||||
} else {
|
} else {
|
||||||
|
@ -1084,21 +1083,21 @@ bool AppInitParameterInteraction()
|
||||||
int64_t nMempoolSizeMax = gArgs.GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000;
|
int64_t nMempoolSizeMax = gArgs.GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000;
|
||||||
int64_t nMempoolSizeMin = gArgs.GetArg("-limitdescendantsize", DEFAULT_DESCENDANT_SIZE_LIMIT) * 1000 * 40;
|
int64_t nMempoolSizeMin = gArgs.GetArg("-limitdescendantsize", DEFAULT_DESCENDANT_SIZE_LIMIT) * 1000 * 40;
|
||||||
if (nMempoolSizeMax < 0 || nMempoolSizeMax < nMempoolSizeMin)
|
if (nMempoolSizeMax < 0 || nMempoolSizeMax < nMempoolSizeMin)
|
||||||
return InitError(strprintf(_("-maxmempool must be at least %d MB").translated, std::ceil(nMempoolSizeMin / 1000000.0)));
|
return InitError(strprintf(_("-maxmempool must be at least %d MB"), std::ceil(nMempoolSizeMin / 1000000.0)));
|
||||||
// incremental relay fee sets the minimum feerate increase necessary for BIP 125 replacement in the mempool
|
// 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.
|
// and the amount the mempool min fee increases above the feerate of txs evicted due to mempool limiting.
|
||||||
if (gArgs.IsArgSet("-incrementalrelayfee"))
|
if (gArgs.IsArgSet("-incrementalrelayfee"))
|
||||||
{
|
{
|
||||||
CAmount n = 0;
|
CAmount n = 0;
|
||||||
if (!ParseMoney(gArgs.GetArg("-incrementalrelayfee", ""), n))
|
if (!ParseMoney(gArgs.GetArg("-incrementalrelayfee", ""), n))
|
||||||
return InitError(AmountErrMsg("incrementalrelayfee", gArgs.GetArg("-incrementalrelayfee", "")).translated);
|
return InitError(AmountErrMsg("incrementalrelayfee", gArgs.GetArg("-incrementalrelayfee", "")));
|
||||||
incrementalRelayFee = CFeeRate(n);
|
incrementalRelayFee = CFeeRate(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
// block pruning; get the amount of disk space (in MiB) to allot for block & undo files
|
// block pruning; get the amount of disk space (in MiB) to allot for block & undo files
|
||||||
int64_t nPruneArg = gArgs.GetArg("-prune", 0);
|
int64_t nPruneArg = gArgs.GetArg("-prune", 0);
|
||||||
if (nPruneArg < 0) {
|
if (nPruneArg < 0) {
|
||||||
return InitError(_("Prune cannot be configured with a negative value.").translated);
|
return InitError(_("Prune cannot be configured with a negative value."));
|
||||||
}
|
}
|
||||||
nPruneTarget = (uint64_t) nPruneArg * 1024 * 1024;
|
nPruneTarget = (uint64_t) nPruneArg * 1024 * 1024;
|
||||||
if (nPruneArg == 1) { // manual pruning: -prune=1
|
if (nPruneArg == 1) { // manual pruning: -prune=1
|
||||||
|
@ -1107,7 +1106,7 @@ bool AppInitParameterInteraction()
|
||||||
fPruneMode = true;
|
fPruneMode = true;
|
||||||
} else if (nPruneTarget) {
|
} else if (nPruneTarget) {
|
||||||
if (nPruneTarget < MIN_DISK_SPACE_FOR_BLOCK_FILES) {
|
if (nPruneTarget < MIN_DISK_SPACE_FOR_BLOCK_FILES) {
|
||||||
return InitError(strprintf(_("Prune configured below the minimum of %d MiB. Please use a higher number.").translated, MIN_DISK_SPACE_FOR_BLOCK_FILES / 1024 / 1024));
|
return InitError(strprintf(_("Prune configured below the minimum of %d MiB. Please use a higher number."), MIN_DISK_SPACE_FOR_BLOCK_FILES / 1024 / 1024));
|
||||||
}
|
}
|
||||||
LogPrintf("Prune configured to target %u MiB on disk for block and undo files.\n", nPruneTarget / 1024 / 1024);
|
LogPrintf("Prune configured to target %u MiB on disk for block and undo files.\n", nPruneTarget / 1024 / 1024);
|
||||||
fPruneMode = true;
|
fPruneMode = true;
|
||||||
|
@ -1120,13 +1119,13 @@ bool AppInitParameterInteraction()
|
||||||
|
|
||||||
peer_connect_timeout = gArgs.GetArg("-peertimeout", DEFAULT_PEER_CONNECT_TIMEOUT);
|
peer_connect_timeout = gArgs.GetArg("-peertimeout", DEFAULT_PEER_CONNECT_TIMEOUT);
|
||||||
if (peer_connect_timeout <= 0) {
|
if (peer_connect_timeout <= 0) {
|
||||||
return InitError("peertimeout cannot be configured with a negative value.");
|
return InitError(Untranslated("peertimeout cannot be configured with a negative value."));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gArgs.IsArgSet("-minrelaytxfee")) {
|
if (gArgs.IsArgSet("-minrelaytxfee")) {
|
||||||
CAmount n = 0;
|
CAmount n = 0;
|
||||||
if (!ParseMoney(gArgs.GetArg("-minrelaytxfee", ""), n)) {
|
if (!ParseMoney(gArgs.GetArg("-minrelaytxfee", ""), n)) {
|
||||||
return InitError(AmountErrMsg("minrelaytxfee", gArgs.GetArg("-minrelaytxfee", "")).translated);
|
return InitError(AmountErrMsg("minrelaytxfee", gArgs.GetArg("-minrelaytxfee", "")));
|
||||||
}
|
}
|
||||||
// High fee check is done afterward in CWallet::CreateWalletFromFile()
|
// High fee check is done afterward in CWallet::CreateWalletFromFile()
|
||||||
::minRelayTxFee = CFeeRate(n);
|
::minRelayTxFee = CFeeRate(n);
|
||||||
|
@ -1142,7 +1141,7 @@ bool AppInitParameterInteraction()
|
||||||
{
|
{
|
||||||
CAmount n = 0;
|
CAmount n = 0;
|
||||||
if (!ParseMoney(gArgs.GetArg("-blockmintxfee", ""), n))
|
if (!ParseMoney(gArgs.GetArg("-blockmintxfee", ""), n))
|
||||||
return InitError(AmountErrMsg("blockmintxfee", gArgs.GetArg("-blockmintxfee", "")).translated);
|
return InitError(AmountErrMsg("blockmintxfee", gArgs.GetArg("-blockmintxfee", "")));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Feerate used to define dust. Shouldn't be changed lightly as old
|
// Feerate used to define dust. Shouldn't be changed lightly as old
|
||||||
|
@ -1151,13 +1150,13 @@ bool AppInitParameterInteraction()
|
||||||
{
|
{
|
||||||
CAmount n = 0;
|
CAmount n = 0;
|
||||||
if (!ParseMoney(gArgs.GetArg("-dustrelayfee", ""), n))
|
if (!ParseMoney(gArgs.GetArg("-dustrelayfee", ""), n))
|
||||||
return InitError(AmountErrMsg("dustrelayfee", gArgs.GetArg("-dustrelayfee", "")).translated);
|
return InitError(AmountErrMsg("dustrelayfee", gArgs.GetArg("-dustrelayfee", "")));
|
||||||
dustRelayFee = CFeeRate(n);
|
dustRelayFee = CFeeRate(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
fRequireStandard = !gArgs.GetBoolArg("-acceptnonstdtxn", !chainparams.RequireStandard());
|
fRequireStandard = !gArgs.GetBoolArg("-acceptnonstdtxn", !chainparams.RequireStandard());
|
||||||
if (!chainparams.IsTestChain() && !fRequireStandard) {
|
if (!chainparams.IsTestChain() && !fRequireStandard) {
|
||||||
return InitError(strprintf("acceptnonstdtxn is not currently supported for %s chain", chainparams.NetworkIDString()));
|
return InitError(strprintf(Untranslated("acceptnonstdtxn is not currently supported for %s chain"), chainparams.NetworkIDString()));
|
||||||
}
|
}
|
||||||
nBytesPerSigOp = gArgs.GetArg("-bytespersigop", nBytesPerSigOp);
|
nBytesPerSigOp = gArgs.GetArg("-bytespersigop", nBytesPerSigOp);
|
||||||
|
|
||||||
|
@ -1174,10 +1173,10 @@ bool AppInitParameterInteraction()
|
||||||
nLocalServices = ServiceFlags(nLocalServices | NODE_BLOOM);
|
nLocalServices = ServiceFlags(nLocalServices | NODE_BLOOM);
|
||||||
|
|
||||||
if (gArgs.GetArg("-rpcserialversion", DEFAULT_RPC_SERIALIZE_VERSION) < 0)
|
if (gArgs.GetArg("-rpcserialversion", DEFAULT_RPC_SERIALIZE_VERSION) < 0)
|
||||||
return InitError("rpcserialversion must be non-negative.");
|
return InitError(Untranslated("rpcserialversion must be non-negative."));
|
||||||
|
|
||||||
if (gArgs.GetArg("-rpcserialversion", DEFAULT_RPC_SERIALIZE_VERSION) > 1)
|
if (gArgs.GetArg("-rpcserialversion", DEFAULT_RPC_SERIALIZE_VERSION) > 1)
|
||||||
return InitError("unknown rpcserialversion requested.");
|
return InitError(Untranslated("Unknown rpcserialversion requested."));
|
||||||
|
|
||||||
nMaxTipAge = gArgs.GetArg("-maxtipage", DEFAULT_MAX_TIP_AGE);
|
nMaxTipAge = gArgs.GetArg("-maxtipage", DEFAULT_MAX_TIP_AGE);
|
||||||
|
|
||||||
|
@ -1189,10 +1188,10 @@ static bool LockDataDirectory(bool probeOnly)
|
||||||
// Make sure only a single Bitcoin process is using the data directory.
|
// Make sure only a single Bitcoin process is using the data directory.
|
||||||
fs::path datadir = GetDataDir();
|
fs::path datadir = GetDataDir();
|
||||||
if (!DirIsWritable(datadir)) {
|
if (!DirIsWritable(datadir)) {
|
||||||
return InitError(strprintf(_("Cannot write to data directory '%s'; check permissions.").translated, datadir.string()));
|
return InitError(strprintf(_("Cannot write to data directory '%s'; check permissions."), datadir.string()));
|
||||||
}
|
}
|
||||||
if (!LockDirectory(datadir, ".lock", probeOnly)) {
|
if (!LockDirectory(datadir, ".lock", probeOnly)) {
|
||||||
return InitError(strprintf(_("Cannot obtain a lock on data directory %s. %s is probably already running.").translated, datadir.string(), PACKAGE_NAME));
|
return InitError(strprintf(_("Cannot obtain a lock on data directory %s. %s is probably already running."), datadir.string(), PACKAGE_NAME));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1210,7 +1209,7 @@ bool AppInitSanityChecks()
|
||||||
|
|
||||||
// Sanity check
|
// Sanity check
|
||||||
if (!InitSanityCheck())
|
if (!InitSanityCheck())
|
||||||
return InitError(strprintf(_("Initialization sanity check failed. %s is shutting down.").translated, PACKAGE_NAME));
|
return InitError(strprintf(_("Initialization sanity check failed. %s is shutting down."), PACKAGE_NAME));
|
||||||
|
|
||||||
// Probe the data directory lock to give an early error message, if possible
|
// Probe the data directory lock to give an early error message, if possible
|
||||||
// We cannot hold the data directory lock here, as the forking for daemon() hasn't yet happened,
|
// We cannot hold the data directory lock here, as the forking for daemon() hasn't yet happened,
|
||||||
|
@ -1246,7 +1245,7 @@ bool AppInitMain(NodeContext& node)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!LogInstance().StartLogging()) {
|
if (!LogInstance().StartLogging()) {
|
||||||
return InitError(strprintf("Could not open debug log file %s",
|
return InitError(strprintf(Untranslated("Could not open debug log file %s"),
|
||||||
LogInstance().m_file_path.string()));
|
LogInstance().m_file_path.string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1346,7 +1345,7 @@ bool AppInitMain(NodeContext& node)
|
||||||
{
|
{
|
||||||
uiInterface.InitMessage_connect(SetRPCWarmupStatus);
|
uiInterface.InitMessage_connect(SetRPCWarmupStatus);
|
||||||
if (!AppInitServers())
|
if (!AppInitServers())
|
||||||
return InitError(_("Unable to start HTTP server. See debug log for details.").translated);
|
return InitError(_("Unable to start HTTP server. See debug log for details."));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ********************************************************* Step 5: verify wallet database integrity
|
// ********************************************************* Step 5: verify wallet database integrity
|
||||||
|
@ -1378,12 +1377,12 @@ bool AppInitMain(NodeContext& node)
|
||||||
std::vector<std::string> uacomments;
|
std::vector<std::string> uacomments;
|
||||||
for (const std::string& cmt : gArgs.GetArgs("-uacomment")) {
|
for (const std::string& cmt : gArgs.GetArgs("-uacomment")) {
|
||||||
if (cmt != SanitizeString(cmt, SAFE_CHARS_UA_COMMENT))
|
if (cmt != SanitizeString(cmt, SAFE_CHARS_UA_COMMENT))
|
||||||
return InitError(strprintf(_("User Agent comment (%s) contains unsafe characters.").translated, cmt));
|
return InitError(strprintf(_("User Agent comment (%s) contains unsafe characters."), cmt));
|
||||||
uacomments.push_back(cmt);
|
uacomments.push_back(cmt);
|
||||||
}
|
}
|
||||||
strSubVersion = FormatSubVersion(CLIENT_NAME, CLIENT_VERSION, uacomments);
|
strSubVersion = FormatSubVersion(CLIENT_NAME, CLIENT_VERSION, uacomments);
|
||||||
if (strSubVersion.size() > MAX_SUBVERSION_LENGTH) {
|
if (strSubVersion.size() > MAX_SUBVERSION_LENGTH) {
|
||||||
return InitError(strprintf(_("Total length of network version string (%i) exceeds maximum length (%i). Reduce the number or size of uacomments.").translated,
|
return InitError(strprintf(_("Total length of network version string (%i) exceeds maximum length (%i). Reduce the number or size of uacomments."),
|
||||||
strSubVersion.size(), MAX_SUBVERSION_LENGTH));
|
strSubVersion.size(), MAX_SUBVERSION_LENGTH));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1392,7 +1391,7 @@ bool AppInitMain(NodeContext& node)
|
||||||
for (const std::string& snet : gArgs.GetArgs("-onlynet")) {
|
for (const std::string& snet : gArgs.GetArgs("-onlynet")) {
|
||||||
enum Network net = ParseNetwork(snet);
|
enum Network net = ParseNetwork(snet);
|
||||||
if (net == NET_UNROUTABLE)
|
if (net == NET_UNROUTABLE)
|
||||||
return InitError(strprintf(_("Unknown network specified in -onlynet: '%s'").translated, snet));
|
return InitError(strprintf(_("Unknown network specified in -onlynet: '%s'"), snet));
|
||||||
nets.insert(net);
|
nets.insert(net);
|
||||||
}
|
}
|
||||||
for (int n = 0; n < NET_MAX; n++) {
|
for (int n = 0; n < NET_MAX; n++) {
|
||||||
|
@ -1413,12 +1412,12 @@ bool AppInitMain(NodeContext& node)
|
||||||
if (proxyArg != "" && proxyArg != "0") {
|
if (proxyArg != "" && proxyArg != "0") {
|
||||||
CService proxyAddr;
|
CService proxyAddr;
|
||||||
if (!Lookup(proxyArg, proxyAddr, 9050, fNameLookup)) {
|
if (!Lookup(proxyArg, proxyAddr, 9050, fNameLookup)) {
|
||||||
return InitError(strprintf(_("Invalid -proxy address or hostname: '%s'").translated, proxyArg));
|
return InitError(strprintf(_("Invalid -proxy address or hostname: '%s'"), proxyArg));
|
||||||
}
|
}
|
||||||
|
|
||||||
proxyType addrProxy = proxyType(proxyAddr, proxyRandomize);
|
proxyType addrProxy = proxyType(proxyAddr, proxyRandomize);
|
||||||
if (!addrProxy.IsValid())
|
if (!addrProxy.IsValid())
|
||||||
return InitError(strprintf(_("Invalid -proxy address or hostname: '%s'").translated, proxyArg));
|
return InitError(strprintf(_("Invalid -proxy address or hostname: '%s'"), proxyArg));
|
||||||
|
|
||||||
SetProxy(NET_IPV4, addrProxy);
|
SetProxy(NET_IPV4, addrProxy);
|
||||||
SetProxy(NET_IPV6, addrProxy);
|
SetProxy(NET_IPV6, addrProxy);
|
||||||
|
@ -1437,11 +1436,11 @@ bool AppInitMain(NodeContext& node)
|
||||||
} else {
|
} else {
|
||||||
CService onionProxy;
|
CService onionProxy;
|
||||||
if (!Lookup(onionArg, onionProxy, 9050, fNameLookup)) {
|
if (!Lookup(onionArg, onionProxy, 9050, fNameLookup)) {
|
||||||
return InitError(strprintf(_("Invalid -onion address or hostname: '%s'").translated, onionArg));
|
return InitError(strprintf(_("Invalid -onion address or hostname: '%s'"), onionArg));
|
||||||
}
|
}
|
||||||
proxyType addrOnion = proxyType(onionProxy, proxyRandomize);
|
proxyType addrOnion = proxyType(onionProxy, proxyRandomize);
|
||||||
if (!addrOnion.IsValid())
|
if (!addrOnion.IsValid())
|
||||||
return InitError(strprintf(_("Invalid -onion address or hostname: '%s'").translated, onionArg));
|
return InitError(strprintf(_("Invalid -onion address or hostname: '%s'"), onionArg));
|
||||||
SetProxy(NET_ONION, addrOnion);
|
SetProxy(NET_ONION, addrOnion);
|
||||||
SetReachable(NET_ONION, true);
|
SetReachable(NET_ONION, true);
|
||||||
}
|
}
|
||||||
|
@ -1457,7 +1456,7 @@ bool AppInitMain(NodeContext& node)
|
||||||
if (Lookup(strAddr, addrLocal, GetListenPort(), fNameLookup) && addrLocal.IsValid())
|
if (Lookup(strAddr, addrLocal, GetListenPort(), fNameLookup) && addrLocal.IsValid())
|
||||||
AddLocal(addrLocal, LOCAL_MANUAL);
|
AddLocal(addrLocal, LOCAL_MANUAL);
|
||||||
else
|
else
|
||||||
return InitError(ResolveErrMsg("externalip", strAddr));
|
return InitError(Untranslated(ResolveErrMsg("externalip", strAddr)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read asmap file if configured
|
// Read asmap file if configured
|
||||||
|
@ -1470,12 +1469,12 @@ bool AppInitMain(NodeContext& node)
|
||||||
asmap_path = GetDataDir() / asmap_path;
|
asmap_path = GetDataDir() / asmap_path;
|
||||||
}
|
}
|
||||||
if (!fs::exists(asmap_path)) {
|
if (!fs::exists(asmap_path)) {
|
||||||
InitError(strprintf(_("Could not find asmap file %s").translated, asmap_path));
|
InitError(strprintf(_("Could not find asmap file %s"), asmap_path));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
std::vector<bool> asmap = CAddrMan::DecodeAsmap(asmap_path);
|
std::vector<bool> asmap = CAddrMan::DecodeAsmap(asmap_path);
|
||||||
if (asmap.size() == 0) {
|
if (asmap.size() == 0) {
|
||||||
InitError(strprintf(_("Could not parse asmap file %s").translated, asmap_path));
|
InitError(strprintf(_("Could not parse asmap file %s"), asmap_path));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const uint256 asmap_version = SerializeHash(asmap);
|
const uint256 asmap_version = SerializeHash(asmap);
|
||||||
|
@ -1581,7 +1580,7 @@ bool AppInitMain(NodeContext& node)
|
||||||
// (we're likely using a testnet datadir, or the other way around).
|
// (we're likely using a testnet datadir, or the other way around).
|
||||||
if (!::BlockIndex().empty() &&
|
if (!::BlockIndex().empty() &&
|
||||||
!LookupBlockIndex(chainparams.GetConsensus().hashGenesisBlock)) {
|
!LookupBlockIndex(chainparams.GetConsensus().hashGenesisBlock)) {
|
||||||
return InitError(_("Incorrect or no genesis block found. Wrong datadir for network?").translated);
|
return InitError(_("Incorrect or no genesis block found. Wrong datadir for network?"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for changed -prune state. What we are concerned about is a user who has pruned blocks
|
// Check for changed -prune state. What we are concerned about is a user who has pruned blocks
|
||||||
|
@ -1744,7 +1743,7 @@ bool AppInitMain(NodeContext& node)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return InitError(strLoadError.translated);
|
return InitError(strLoadError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1807,11 +1806,11 @@ bool AppInitMain(NodeContext& node)
|
||||||
// ********************************************************* Step 11: import blocks
|
// ********************************************************* Step 11: import blocks
|
||||||
|
|
||||||
if (!CheckDiskSpace(GetDataDir())) {
|
if (!CheckDiskSpace(GetDataDir())) {
|
||||||
InitError(strprintf(_("Error: Disk space is low for %s").translated, GetDataDir()));
|
InitError(strprintf(_("Error: Disk space is low for %s"), GetDataDir()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!CheckDiskSpace(GetBlocksDir())) {
|
if (!CheckDiskSpace(GetBlocksDir())) {
|
||||||
InitError(strprintf(_("Error: Disk space is low for %s").translated, GetBlocksDir()));
|
InitError(strprintf(_("Error: Disk space is low for %s"), GetBlocksDir()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1896,21 +1895,21 @@ bool AppInitMain(NodeContext& node)
|
||||||
for (const std::string& strBind : gArgs.GetArgs("-bind")) {
|
for (const std::string& strBind : gArgs.GetArgs("-bind")) {
|
||||||
CService addrBind;
|
CService addrBind;
|
||||||
if (!Lookup(strBind, addrBind, GetListenPort(), false)) {
|
if (!Lookup(strBind, addrBind, GetListenPort(), false)) {
|
||||||
return InitError(ResolveErrMsg("bind", strBind));
|
return InitError(Untranslated(ResolveErrMsg("bind", strBind)));
|
||||||
}
|
}
|
||||||
connOptions.vBinds.push_back(addrBind);
|
connOptions.vBinds.push_back(addrBind);
|
||||||
}
|
}
|
||||||
for (const std::string& strBind : gArgs.GetArgs("-whitebind")) {
|
for (const std::string& strBind : gArgs.GetArgs("-whitebind")) {
|
||||||
NetWhitebindPermissions whitebind;
|
NetWhitebindPermissions whitebind;
|
||||||
std::string error;
|
std::string error;
|
||||||
if (!NetWhitebindPermissions::TryParse(strBind, whitebind, error)) return InitError(error);
|
if (!NetWhitebindPermissions::TryParse(strBind, whitebind, error)) return InitError(Untranslated(error));
|
||||||
connOptions.vWhiteBinds.push_back(whitebind);
|
connOptions.vWhiteBinds.push_back(whitebind);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto& net : gArgs.GetArgs("-whitelist")) {
|
for (const auto& net : gArgs.GetArgs("-whitelist")) {
|
||||||
NetWhitelistPermissions subnet;
|
NetWhitelistPermissions subnet;
|
||||||
std::string error;
|
std::string error;
|
||||||
if (!NetWhitelistPermissions::TryParse(net, subnet, error)) return InitError(error);
|
if (!NetWhitelistPermissions::TryParse(net, subnet, error)) return InitError(Untranslated(error));
|
||||||
connOptions.vWhitelistedRange.push_back(subnet);
|
connOptions.vWhitelistedRange.push_back(subnet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -345,7 +345,7 @@ public:
|
||||||
int64_t getAdjustedTime() override { return GetAdjustedTime(); }
|
int64_t getAdjustedTime() override { return GetAdjustedTime(); }
|
||||||
void initMessage(const std::string& message) override { ::uiInterface.InitMessage(message); }
|
void initMessage(const std::string& message) override { ::uiInterface.InitMessage(message); }
|
||||||
void initWarning(const std::string& message) override { InitWarning(message); }
|
void initWarning(const std::string& message) override { InitWarning(message); }
|
||||||
void initError(const std::string& message) override { InitError(message); }
|
void initError(const bilingual_str& message) override { InitError(message); }
|
||||||
void showProgress(const std::string& title, int progress, bool resume_possible) override
|
void showProgress(const std::string& title, int progress, bool resume_possible) override
|
||||||
{
|
{
|
||||||
::uiInterface.ShowProgress(title, progress, resume_possible);
|
::uiInterface.ShowProgress(title, progress, resume_possible);
|
||||||
|
|
|
@ -21,6 +21,7 @@ class CScheduler;
|
||||||
class Coin;
|
class Coin;
|
||||||
class uint256;
|
class uint256;
|
||||||
enum class RBFTransactionState;
|
enum class RBFTransactionState;
|
||||||
|
struct bilingual_str;
|
||||||
struct CBlockLocator;
|
struct CBlockLocator;
|
||||||
struct FeeCalculation;
|
struct FeeCalculation;
|
||||||
struct NodeContext;
|
struct NodeContext;
|
||||||
|
@ -227,7 +228,7 @@ public:
|
||||||
virtual void initWarning(const std::string& message) = 0;
|
virtual void initWarning(const std::string& message) = 0;
|
||||||
|
|
||||||
//! Send init error.
|
//! Send init error.
|
||||||
virtual void initError(const std::string& message) = 0;
|
virtual void initError(const bilingual_str& message) = 0;
|
||||||
|
|
||||||
//! Send progress indicator.
|
//! Send progress indicator.
|
||||||
virtual void showProgress(const std::string& title, int progress, bool resume_possible) = 0;
|
virtual void showProgress(const std::string& title, int progress, bool resume_possible) = 0;
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include <txmempool.h>
|
#include <txmempool.h>
|
||||||
#include <ui_interface.h>
|
#include <ui_interface.h>
|
||||||
#include <util/system.h>
|
#include <util/system.h>
|
||||||
|
#include <util/translation.h>
|
||||||
#include <validation.h>
|
#include <validation.h>
|
||||||
#include <warnings.h>
|
#include <warnings.h>
|
||||||
|
|
||||||
|
@ -54,7 +55,7 @@ namespace {
|
||||||
class NodeImpl : public Node
|
class NodeImpl : public Node
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void initError(const std::string& message) override { InitError(message); }
|
void initError(const std::string& message) override { InitError(Untranslated(message)); }
|
||||||
bool parseParameters(int argc, const char* const argv[], std::string& error) override
|
bool parseParameters(int argc, const char* const argv[], std::string& error) override
|
||||||
{
|
{
|
||||||
return gArgs.ParseParameters(argc, argv, error);
|
return gArgs.ParseParameters(argc, argv, error);
|
||||||
|
|
|
@ -53,10 +53,9 @@ void CClientUIInterface::NotifyBlockTip(bool b, const CBlockIndex* i) { return g
|
||||||
void CClientUIInterface::NotifyHeaderTip(bool b, const CBlockIndex* i) { return g_ui_signals.NotifyHeaderTip(b, i); }
|
void CClientUIInterface::NotifyHeaderTip(bool b, const CBlockIndex* i) { return g_ui_signals.NotifyHeaderTip(b, i); }
|
||||||
void CClientUIInterface::BannedListChanged() { return g_ui_signals.BannedListChanged(); }
|
void CClientUIInterface::BannedListChanged() { return g_ui_signals.BannedListChanged(); }
|
||||||
|
|
||||||
|
bool InitError(const bilingual_str& str)
|
||||||
bool InitError(const std::string& str)
|
|
||||||
{
|
{
|
||||||
uiInterface.ThreadSafeMessageBox(Untranslated(str), "", CClientUIInterface::MSG_ERROR);
|
uiInterface.ThreadSafeMessageBox(str, "", CClientUIInterface::MSG_ERROR);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -120,10 +120,11 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Show warning message **/
|
/** Show warning message **/
|
||||||
|
// TODO: InitWarning() should take a bilingual_str parameter.
|
||||||
void InitWarning(const std::string& str);
|
void InitWarning(const std::string& str);
|
||||||
|
|
||||||
/** Show error message **/
|
/** Show error message **/
|
||||||
bool InitError(const std::string& str);
|
bool InitError(const bilingual_str& str);
|
||||||
|
|
||||||
extern CClientUIInterface uiInterface;
|
extern CClientUIInterface uiInterface;
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ bool WalletInit::ParameterInteraction() const
|
||||||
|
|
||||||
if (gArgs.GetBoolArg("-salvagewallet", false)) {
|
if (gArgs.GetBoolArg("-salvagewallet", false)) {
|
||||||
if (is_multiwallet) {
|
if (is_multiwallet) {
|
||||||
return InitError(strprintf("%s is only allowed with a single wallet file", "-salvagewallet"));
|
return InitError(strprintf(Untranslated("%s is only allowed with a single wallet file"), "-salvagewallet"));
|
||||||
}
|
}
|
||||||
// Rewrite just private keys: rescan to find transactions
|
// Rewrite just private keys: rescan to find transactions
|
||||||
if (gArgs.SoftSetBoolArg("-rescan", true)) {
|
if (gArgs.SoftSetBoolArg("-rescan", true)) {
|
||||||
|
@ -108,7 +108,7 @@ bool WalletInit::ParameterInteraction() const
|
||||||
// -zapwallettxes implies a rescan
|
// -zapwallettxes implies a rescan
|
||||||
if (zapwallettxes) {
|
if (zapwallettxes) {
|
||||||
if (is_multiwallet) {
|
if (is_multiwallet) {
|
||||||
return InitError(strprintf("%s is only allowed with a single wallet file", "-zapwallettxes"));
|
return InitError(strprintf(Untranslated("%s is only allowed with a single wallet file"), "-zapwallettxes"));
|
||||||
}
|
}
|
||||||
if (gArgs.SoftSetBoolArg("-rescan", true)) {
|
if (gArgs.SoftSetBoolArg("-rescan", true)) {
|
||||||
LogPrintf("%s: parameter interaction: -zapwallettxes enabled -> setting -rescan=1\n", __func__);
|
LogPrintf("%s: parameter interaction: -zapwallettxes enabled -> setting -rescan=1\n", __func__);
|
||||||
|
@ -116,7 +116,7 @@ bool WalletInit::ParameterInteraction() const
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gArgs.GetBoolArg("-sysperms", false))
|
if (gArgs.GetBoolArg("-sysperms", false))
|
||||||
return InitError("-sysperms is not allowed in combination with enabled wallet functionality");
|
return InitError(Untranslated("-sysperms is not allowed in combination with enabled wallet functionality"));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,14 +20,14 @@ 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
|
// 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);
|
fs::path canonical_wallet_dir = fs::canonical(wallet_dir, error);
|
||||||
if (error || !fs::exists(wallet_dir)) {
|
if (error || !fs::exists(wallet_dir)) {
|
||||||
chain.initError(strprintf(_("Specified -walletdir \"%s\" does not exist").translated, wallet_dir.string()));
|
chain.initError(strprintf(_("Specified -walletdir \"%s\" does not exist"), wallet_dir.string()));
|
||||||
return false;
|
return false;
|
||||||
} else if (!fs::is_directory(wallet_dir)) {
|
} else if (!fs::is_directory(wallet_dir)) {
|
||||||
chain.initError(strprintf(_("Specified -walletdir \"%s\" is not a directory").translated, wallet_dir.string()));
|
chain.initError(strprintf(_("Specified -walletdir \"%s\" is not a directory"), wallet_dir.string()));
|
||||||
return false;
|
return false;
|
||||||
// The canonical path transforms relative paths into absolute ones, so we check the non-canonical version
|
// The canonical path transforms relative paths into absolute ones, so we check the non-canonical version
|
||||||
} else if (!wallet_dir.is_absolute()) {
|
} else if (!wallet_dir.is_absolute()) {
|
||||||
chain.initError(strprintf(_("Specified -walletdir \"%s\" is a relative path").translated, wallet_dir.string()));
|
chain.initError(strprintf(_("Specified -walletdir \"%s\" is a relative path"), wallet_dir.string()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
gArgs.ForceSetArg("-walletdir", canonical_wallet_dir.string());
|
gArgs.ForceSetArg("-walletdir", canonical_wallet_dir.string());
|
||||||
|
@ -49,7 +49,7 @@ bool VerifyWallets(interfaces::Chain& chain, const std::vector<std::string>& wal
|
||||||
WalletLocation location(wallet_file);
|
WalletLocation location(wallet_file);
|
||||||
|
|
||||||
if (!wallet_paths.insert(location.GetPath()).second) {
|
if (!wallet_paths.insert(location.GetPath()).second) {
|
||||||
chain.initError(strprintf(_("Error loading wallet %s. Duplicate -wallet filename specified.").translated, wallet_file));
|
chain.initError(strprintf(_("Error loading wallet %s. Duplicate -wallet filename specified."), wallet_file));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ bool VerifyWallets(interfaces::Chain& chain, const std::vector<std::string>& wal
|
||||||
bool verify_success = CWallet::Verify(chain, location, salvage_wallet, error_string, warnings);
|
bool verify_success = CWallet::Verify(chain, location, salvage_wallet, error_string, warnings);
|
||||||
if (!warnings.empty()) chain.initWarning(Join(warnings, "\n", OpTranslated));
|
if (!warnings.empty()) chain.initWarning(Join(warnings, "\n", OpTranslated));
|
||||||
if (!verify_success) {
|
if (!verify_success) {
|
||||||
chain.initError(error_string.translated);
|
chain.initError(error_string);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -75,14 +75,14 @@ bool LoadWallets(interfaces::Chain& chain, const std::vector<std::string>& walle
|
||||||
std::shared_ptr<CWallet> pwallet = CWallet::CreateWalletFromFile(chain, WalletLocation(walletFile), error, warnings);
|
std::shared_ptr<CWallet> pwallet = CWallet::CreateWalletFromFile(chain, WalletLocation(walletFile), error, warnings);
|
||||||
if (!warnings.empty()) chain.initWarning(Join(warnings, "\n", OpTranslated));
|
if (!warnings.empty()) chain.initWarning(Join(warnings, "\n", OpTranslated));
|
||||||
if (!pwallet) {
|
if (!pwallet) {
|
||||||
chain.initError(error.translated);
|
chain.initError(error);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
AddWallet(pwallet);
|
AddWallet(pwallet);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} catch (const std::runtime_error& e) {
|
} catch (const std::runtime_error& e) {
|
||||||
chain.initError(e.what());
|
chain.initError(Untranslated(e.what()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue