mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
Merge 1884ce2f4c into merged_master (Bitcoin PR bitcoin/bitcoin#22937)
This commit is contained in:
commit
2b8eef42dd
45 changed files with 348 additions and 197 deletions
26
src/init.cpp
26
src/init.cpp
|
|
@ -122,7 +122,7 @@ const char * const BITCOIN_PID_FILENAME = "elementsd.pid";
|
|||
|
||||
static fs::path GetPidFile(const ArgsManager& args)
|
||||
{
|
||||
return AbsPathForConfigVal(fs::path(args.GetArg("-pid", BITCOIN_PID_FILENAME)));
|
||||
return AbsPathForConfigVal(fs::PathFromString(args.GetArg("-pid", BITCOIN_PID_FILENAME)));
|
||||
}
|
||||
|
||||
[[nodiscard]] static bool CreatePidFile(const ArgsManager& args)
|
||||
|
|
@ -136,7 +136,7 @@ static fs::path GetPidFile(const ArgsManager& args)
|
|||
#endif
|
||||
return true;
|
||||
} else {
|
||||
return InitError(strprintf(_("Unable to create the PID file '%s': %s"), GetPidFile(args).string(), std::strerror(errno)));
|
||||
return InitError(strprintf(_("Unable to create the PID file '%s': %s"), fs::PathToString(GetPidFile(args)), std::strerror(errno)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1134,10 +1134,10 @@ static bool LockDataDirectory(bool probeOnly)
|
|||
// Make sure only a single Bitcoin process is using the data directory.
|
||||
fs::path datadir = gArgs.GetDataDirNet();
|
||||
if (!DirIsWritable(datadir)) {
|
||||
return InitError(strprintf(_("Cannot write to data directory '%s'; check permissions."), datadir.string()));
|
||||
return InitError(strprintf(_("Cannot write to data directory '%s'; check permissions."), fs::PathToString(datadir)));
|
||||
}
|
||||
if (!LockDirectory(datadir, ".lock", probeOnly)) {
|
||||
return InitError(strprintf(_("Cannot obtain a lock on data directory %s. %s is probably already running."), datadir.string(), PACKAGE_NAME));
|
||||
return InitError(strprintf(_("Cannot obtain a lock on data directory %s. %s is probably already running."), fs::PathToString(datadir), PACKAGE_NAME));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1253,12 +1253,12 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
|||
LogPrintf("Using at most %i automatic connections (%i file descriptors available)\n", nMaxConnections, nFD);
|
||||
|
||||
// Warn about relative -datadir path.
|
||||
if (args.IsArgSet("-datadir") && !fs::path(args.GetArg("-datadir", "")).is_absolute()) {
|
||||
if (args.IsArgSet("-datadir") && !fs::PathFromString(args.GetArg("-datadir", "")).is_absolute()) {
|
||||
LogPrintf("Warning: relative datadir option '%s' specified, which will be interpreted relative to the " /* Continued */
|
||||
"current working directory '%s'. This is fragile, because if bitcoin is started in the future "
|
||||
"from a different location, it will be unable to locate the current data files. There could "
|
||||
"also be data loss if bitcoin is started while in a temporary directory.\n",
|
||||
args.GetArg("-datadir", ""), fs::current_path().string());
|
||||
args.GetArg("-datadir", ""), fs::PathToString(fs::current_path()));
|
||||
}
|
||||
|
||||
InitSignatureCache();
|
||||
|
|
@ -1350,20 +1350,20 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
|||
// Read asmap file if configured
|
||||
std::vector<bool> asmap;
|
||||
if (args.IsArgSet("-asmap")) {
|
||||
fs::path asmap_path = fs::path(args.GetArg("-asmap", ""));
|
||||
fs::path asmap_path = fs::PathFromString(args.GetArg("-asmap", ""));
|
||||
if (asmap_path.empty()) {
|
||||
asmap_path = DEFAULT_ASMAP_FILENAME;
|
||||
asmap_path = fs::PathFromString(DEFAULT_ASMAP_FILENAME);
|
||||
}
|
||||
if (!asmap_path.is_absolute()) {
|
||||
asmap_path = gArgs.GetDataDirNet() / asmap_path;
|
||||
}
|
||||
if (!fs::exists(asmap_path)) {
|
||||
InitError(strprintf(_("Could not find asmap file %s"), asmap_path));
|
||||
InitError(strprintf(_("Could not find asmap file %s"), fs::quoted(fs::PathToString(asmap_path))));
|
||||
return false;
|
||||
}
|
||||
asmap = DecodeAsmap(asmap_path);
|
||||
if (asmap.size() == 0) {
|
||||
InitError(strprintf(_("Could not parse asmap file %s"), asmap_path));
|
||||
InitError(strprintf(_("Could not parse asmap file %s"), fs::quoted(fs::PathToString(asmap_path))));
|
||||
return false;
|
||||
}
|
||||
const uint256 asmap_version = SerializeHash(asmap);
|
||||
|
|
@ -1793,11 +1793,11 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
|||
// ********************************************************* Step 11: import blocks
|
||||
|
||||
if (!CheckDiskSpace(gArgs.GetDataDirNet())) {
|
||||
InitError(strprintf(_("Error: Disk space is low for %s"), gArgs.GetDataDirNet()));
|
||||
InitError(strprintf(_("Error: Disk space is low for %s"), fs::quoted(fs::PathToString(gArgs.GetDataDirNet()))));
|
||||
return false;
|
||||
}
|
||||
if (!CheckDiskSpace(gArgs.GetBlocksDirPath())) {
|
||||
InitError(strprintf(_("Error: Disk space is low for %s"), gArgs.GetBlocksDirPath()));
|
||||
InitError(strprintf(_("Error: Disk space is low for %s"), fs::quoted(fs::PathToString(gArgs.GetBlocksDirPath()))));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1825,7 +1825,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
|||
|
||||
std::vector<fs::path> vImportFiles;
|
||||
for (const std::string& strFile : args.GetArgs("-loadblock")) {
|
||||
vImportFiles.push_back(strFile);
|
||||
vImportFiles.push_back(fs::PathFromString(strFile));
|
||||
}
|
||||
|
||||
chainman.m_load_block = std::thread(&util::TraceThread, "loadblk", [=, &chainman, &args] {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue