Backport Bitcoin PR#7458 : [Net] peers.dat, banlist.dat recreated when missing (#1506)

This commit is contained in:
Oleg Girko 2017-07-05 00:26:13 +01:00 committed by UdjinM6
parent ac6c3c9008
commit d787fe4ab6

View File

@ -1962,8 +1962,10 @@ void StartNode(boost::thread_group& threadGroup, CScheduler& scheduler)
CAddrDB adb; CAddrDB adb;
if (adb.Read(addrman)) if (adb.Read(addrman))
LogPrintf("Loaded %i addresses from peers.dat %dms\n", addrman.size(), GetTimeMillis() - nStart); LogPrintf("Loaded %i addresses from peers.dat %dms\n", addrman.size(), GetTimeMillis() - nStart);
else else {
LogPrintf("Invalid or missing peers.dat; recreating\n"); LogPrintf("Invalid or missing peers.dat; recreating\n");
DumpAddresses();
}
} }
uiInterface.InitMessage(_("Loading banlist...")); uiInterface.InitMessage(_("Loading banlist..."));
@ -1978,8 +1980,11 @@ void StartNode(boost::thread_group& threadGroup, CScheduler& scheduler)
LogPrint("net", "Loaded %d banned node ips/subnets from banlist.dat %dms\n", LogPrint("net", "Loaded %d banned node ips/subnets from banlist.dat %dms\n",
banmap.size(), GetTimeMillis() - nStart); banmap.size(), GetTimeMillis() - nStart);
} else } else {
LogPrintf("Invalid or missing banlist.dat; recreating\n"); LogPrintf("Invalid or missing banlist.dat; recreating\n");
CNode::SetBannedSetDirty(true); // force write
DumpBanlist();
}
fAddressesInitialized = true; fAddressesInitialized = true;