Default to using contrib asmap if -asmap CLI arg is specified with no argument
This commit is contained in:
15
src/init.cpp
15
src/init.cpp
@@ -122,7 +122,7 @@ enum BindFlags {
|
|||||||
|
|
||||||
static const char* FEE_ESTIMATES_FILENAME="fee_estimates.dat";
|
static const char* FEE_ESTIMATES_FILENAME="fee_estimates.dat";
|
||||||
|
|
||||||
static const char* DEFAULT_ASMAP_FILENAME="ip_asn.map";
|
static const char* DEFAULT_ASMAP_FILENAME="asmap.dat";
|
||||||
|
|
||||||
CClientUIInterface uiInterface; // Declared but not defined in ui_interface.h
|
CClientUIInterface uiInterface; // Declared but not defined in ui_interface.h
|
||||||
|
|
||||||
@@ -1089,8 +1089,15 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
// Read asmap file if configured
|
// Read asmap file if configured
|
||||||
if (mapArgs.count("-asmap")) {
|
if (mapArgs.count("-asmap")) {
|
||||||
fs::path asmap_path = fs::path(GetArg("-asmap", ""));
|
fs::path asmap_path = fs::path(GetArg("-asmap", ""));
|
||||||
|
|
||||||
|
char cwd[1024];
|
||||||
|
bool ret = getcwd(cwd, sizeof(cwd));
|
||||||
|
fs::path pwd = fs::path(cwd);
|
||||||
|
fs::path contrib = pwd / "contrib" / "asmap";
|
||||||
|
|
||||||
|
// if no filepath, use the default in contrib
|
||||||
if (asmap_path.empty()) {
|
if (asmap_path.empty()) {
|
||||||
asmap_path = DEFAULT_ASMAP_FILENAME;
|
asmap_path = pwd / DEFAULT_ASMAP_FILENAME;
|
||||||
}
|
}
|
||||||
if (!asmap_path.is_absolute()) {
|
if (!asmap_path.is_absolute()) {
|
||||||
asmap_path = GetDataDir() / asmap_path;
|
asmap_path = GetDataDir() / asmap_path;
|
||||||
@@ -1107,8 +1114,10 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
const uint256 asmap_version = SerializeHash(asmap);
|
const uint256 asmap_version = SerializeHash(asmap);
|
||||||
addrman.m_asmap = std::move(asmap); // //node.connman->SetAsmap(std::move(asmap));
|
addrman.m_asmap = std::move(asmap); // //node.connman->SetAsmap(std::move(asmap));
|
||||||
LogPrintf("Using asmap version %s for IP bucketing\n", asmap_version.ToString());
|
LogPrintf("Using asmap version %s for IP bucketing\n", asmap_version.ToString());
|
||||||
|
|
||||||
|
printf("%s: asmap version=%s with %d mappings\n", __func__, asmap_version.ToString(), asmap.size());
|
||||||
} else {
|
} else {
|
||||||
LogPrintf("Using /16 prefix for IP bucketing\n");
|
LogPrintf("Using /16 prefix for IP bucketing, but why?\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetBoolArg("-salvagewallet", false)) {
|
if (GetBoolArg("-salvagewallet", false)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user