diff options
Diffstat (limited to 'src/addrdb.h')
-rw-r--r-- | src/addrdb.h | 45 |
1 files changed, 6 insertions, 39 deletions
diff --git a/src/addrdb.h b/src/addrdb.h index 26400ee0b6..c31c126ee3 100644 --- a/src/addrdb.h +++ b/src/addrdb.h @@ -12,48 +12,15 @@ #include <vector> -class CAddress; +class ArgsManager; class CAddrMan; +class CAddress; class CDataStream; -class CBanEntry -{ -public: - static constexpr int CURRENT_VERSION{1}; - int nVersion{CBanEntry::CURRENT_VERSION}; - int64_t nCreateTime{0}; - int64_t nBanUntil{0}; - - CBanEntry() {} - - explicit CBanEntry(int64_t nCreateTimeIn) - : nCreateTime{nCreateTimeIn} {} - - /** - * Create a ban entry from JSON. - * @param[in] json A JSON representation of a ban entry, as created by `ToJson()`. - * @throw std::runtime_error if the JSON does not have the expected fields. - */ - explicit CBanEntry(const UniValue& json); - - /** - * Generate a JSON representation of this ban entry. - * @return JSON suitable for passing to the `CBanEntry(const UniValue&)` constructor. - */ - UniValue ToJson() const; -}; - -/** Access to the (IP) address database (peers.dat) */ -class CAddrDB -{ -private: - fs::path pathAddr; -public: - CAddrDB(); - bool Write(const CAddrMan& addr); - bool Read(CAddrMan& addr); - static bool Read(CAddrMan& addr, CDataStream& ssPeers); -}; +bool DumpPeerAddresses(const ArgsManager& args, const CAddrMan& addr); +bool ReadPeerAddresses(const ArgsManager& args, CAddrMan& addr); +/** Only used by tests. */ +bool ReadFromStream(CAddrMan& addr, CDataStream& ssPeers); /** Access to the banlist database (banlist.json) */ class CBanDB |