Changeset View
Changeset View
Standalone View
Standalone View
src/addrdb.cpp
// Copyright (c) 2009-2010 Satoshi Nakamoto | // Copyright (c) 2009-2010 Satoshi Nakamoto | ||||
// Copyright (c) 2009-2016 The Bitcoin Core developers | // Copyright (c) 2009-2016 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include <addrdb.h> | #include <addrdb.h> | ||||
#include <addrman.h> | #include <addrman.h> | ||||
#include <chainparams.h> | #include <chainparams.h> | ||||
#include <clientversion.h> | #include <clientversion.h> | ||||
#include <hash.h> | #include <hash.h> | ||||
#include <logging/timer.h> | |||||
#include <random.h> | #include <random.h> | ||||
#include <streams.h> | #include <streams.h> | ||||
#include <tinyformat.h> | #include <tinyformat.h> | ||||
#include <util/system.h> | #include <util/system.h> | ||||
#include <cstdint> | #include <cstdint> | ||||
namespace { | namespace { | ||||
▲ Show 20 Lines • Show All 128 Lines • ▼ Show 20 Lines | |||||
bool CAddrDB::Read(CAddrMan &addr, CDataStream &ssPeers) { | bool CAddrDB::Read(CAddrMan &addr, CDataStream &ssPeers) { | ||||
bool ret = DeserializeDB(chainParams, ssPeers, addr, false); | bool ret = DeserializeDB(chainParams, ssPeers, addr, false); | ||||
if (!ret) { | if (!ret) { | ||||
// Ensure addrman is left in a clean state | // Ensure addrman is left in a clean state | ||||
addr.Clear(); | addr.Clear(); | ||||
} | } | ||||
return ret; | return ret; | ||||
} | } | ||||
void DumpAnchors(const CChainParams &chainParams, | |||||
const fs::path &anchors_db_path, | |||||
const std::vector<CAddress> &anchors) { | |||||
LOG_TIME_SECONDS(strprintf( | |||||
"Flush %d outbound block-relay-only peer addresses to anchors.dat", | |||||
anchors.size())); | |||||
SerializeFileDB(chainParams, "anchors", anchors_db_path, anchors); | |||||
} |