diff options
author | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2020-09-12 18:01:19 +0300 |
---|---|---|
committer | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2020-10-09 14:29:04 +0300 |
commit | c29272a157d09a8125788c1b860e89b63b4cb36c (patch) | |
tree | 378a03059381306e7e5ca2cbfafea1790ca9583c /src/addrdb.cpp | |
parent | 567008d2a0c95bd972f4031f31647c493d1bc2e8 (diff) |
p2p: Add ReadAnchors()
Diffstat (limited to 'src/addrdb.cpp')
-rw-r--r-- | src/addrdb.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/addrdb.cpp b/src/addrdb.cpp index ca2d66570b..27f22826a9 100644 --- a/src/addrdb.cpp +++ b/src/addrdb.cpp @@ -163,3 +163,16 @@ void DumpAnchors(const fs::path& anchors_db_path, const std::vector<CAddress>& a LOG_TIME_SECONDS(strprintf("Flush %d outbound block-relay-only peer addresses to anchors.dat", anchors.size())); SerializeFileDB("anchors", anchors_db_path, anchors); } + +std::vector<CAddress> ReadAnchors(const fs::path& anchors_db_path) +{ + std::vector<CAddress> anchors; + if (DeserializeFileDB(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; +} |