Changeset View
Changeset View
Standalone View
Standalone View
src/addrdb.cpp
Show First 20 Lines • Show All 157 Lines • ▼ Show 20 Lines | |||||
void DumpAnchors(const CChainParams &chainParams, | void DumpAnchors(const CChainParams &chainParams, | ||||
const fs::path &anchors_db_path, | const fs::path &anchors_db_path, | ||||
const std::vector<CAddress> &anchors) { | const std::vector<CAddress> &anchors) { | ||||
LOG_TIME_SECONDS(strprintf( | LOG_TIME_SECONDS(strprintf( | ||||
"Flush %d outbound block-relay-only peer addresses to anchors.dat", | "Flush %d outbound block-relay-only peer addresses to anchors.dat", | ||||
anchors.size())); | anchors.size())); | ||||
SerializeFileDB(chainParams, "anchors", anchors_db_path, anchors); | SerializeFileDB(chainParams, "anchors", anchors_db_path, anchors); | ||||
} | } | ||||
std::vector<CAddress> ReadAnchors(const CChainParams &chainParams, | |||||
const fs::path &anchors_db_path) { | |||||
std::vector<CAddress> anchors; | |||||
if (DeserializeFileDB(chainParams, anchors_db_path, anchors)) { | |||||
LogPrintf("Loaded %i addresses from %s\n", anchors.size(), | |||||
anchors_db_path.filename()); | |||||
} else { | |||||
anchors.clear(); | |||||
} | |||||
fs::remove(anchors_db_path); | |||||
return anchors; | |||||
} |