Bitcoin ABC 0.26.3
P2P Digital Currency
Loading...
Searching...
No Matches
addrdb.h
Go to the documentation of this file.
1// Copyright (c) 2009-2010 Satoshi Nakamoto
2// Copyright (c) 2009-2016 The Bitcoin Core developers
3// Distributed under the MIT software license, see the accompanying
4// file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
6#ifndef BITCOIN_ADDRDB_H
7#define BITCOIN_ADDRDB_H
8
9#include <net_types.h>
10#include <serialize.h>
11#include <util/fs.h>
12#include <util/result.h>
13
14#include <memory>
15#include <string>
16#include <vector>
17
18class ArgsManager;
19class AddrMan;
20class CAddress;
21class CDataStream;
22class CChainParams;
23
24bool DumpPeerAddresses(const CChainParams &chainParams, const ArgsManager &args,
25 const AddrMan &addr);
27void ReadFromStream(const CChainParams &chainParams, AddrMan &addr,
29
30class CBanEntry {
31public:
32 static const int CURRENT_VERSION = 1;
36
38
43
47 READWRITE(obj.nVersion, obj.nCreateTime, obj.nBanUntil, ban_reason);
48 }
49
55};
56
58class CBanDB {
59private:
62
63public:
65 bool Write(const banmap_t &banSet);
66 bool Read(banmap_t &banSet);
67};
68
71LoadAddrman(const CChainParams &chainparams, const std::vector<bool> &asmap,
72 const ArgsManager &args);
73
80void DumpAnchors(const CChainParams &chainParams,
82 const std::vector<CAddress> &anchors);
83
91std::vector<CAddress> ReadAnchors(const CChainParams &chainParams,
93
94#endif // BITCOIN_ADDRDB_H
std::vector< CAddress > ReadAnchors(const CChainParams &chainParams, const fs::path &anchors_db_path)
Read the anchor IP address database (anchors.dat)
Definition addrdb.cpp:224
util::Result< std::unique_ptr< AddrMan > > LoadAddrman(const CChainParams &chainparams, const std::vector< bool > &asmap, const ArgsManager &args)
Returns an error string on failure.
Definition addrdb.cpp:164
void ReadFromStream(const CChainParams &chainParams, AddrMan &addr, CDataStream &ssPeers)
Only used by tests.
Definition addrdb.cpp:158
bool DumpPeerAddresses(const CChainParams &chainParams, const ArgsManager &args, const AddrMan &addr)
Definition addrdb.cpp:151
void DumpAnchors(const CChainParams &chainParams, const fs::path &anchors_db_path, const std::vector< CAddress > &anchors)
Dump the anchor IP address database (anchors.dat)
Definition addrdb.cpp:214
Stochastic address manager.
Definition addrman.h:68
A CService with information about it as peer.
Definition protocol.h:442
Access to the banlist database (banlist.dat)
Definition addrdb.h:58
bool Write(const banmap_t &banSet)
Definition addrdb.cpp:130
const fs::path m_ban_list_path
Definition addrdb.h:60
bool Read(banmap_t &banSet)
Definition addrdb.cpp:135
const CChainParams & chainParams
Definition addrdb.h:61
Definition addrdb.h:30
static const int CURRENT_VERSION
Definition addrdb.h:32
int64_t nCreateTime
Definition addrdb.h:34
CBanEntry()
Definition addrdb.h:37
CBanEntry(int64_t nCreateTimeIn)
Definition addrdb.h:39
SERIALIZE_METHODS(CBanEntry, obj)
Definition addrdb.h:44
void SetNull()
Definition addrdb.h:50
int nVersion
Definition addrdb.h:33
int64_t nBanUntil
Definition addrdb.h:35
CChainParams defines various tweakable parameters of a given instance of the Bitcoin system.
Definition chainparams.h:80
Double ended buffer combining vector and stream-like interfaces.
Definition streams.h:177
Path class wrapper to block calls to the fs::path(std::string) implicit constructor and the fs::path:...
Definition fs.h:30
std::map< CSubNet, CBanEntry > banmap_t
Definition net_types.h:13
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
Definition random.h:85
#define READWRITE(...)
Definition serialize.h:166