asmap bucketing ported from Komodo
This commit is contained in:
16
src/net.h
16
src/net.h
@@ -114,6 +114,9 @@ static std::string validationdescription;
|
||||
|
||||
typedef int NodeId;
|
||||
|
||||
class CNodeStats;
|
||||
void CopyNodeStats(std::vector<CNodeStats>& vstats);
|
||||
|
||||
struct CombinerAll
|
||||
{
|
||||
typedef bool result_type;
|
||||
@@ -202,7 +205,6 @@ struct LocalServiceInfo {
|
||||
int nPort;
|
||||
};
|
||||
|
||||
|
||||
extern CCriticalSection cs_mapLocalHost;
|
||||
extern std::map<CNetAddr, LocalServiceInfo> mapLocalHost;
|
||||
|
||||
@@ -227,6 +229,11 @@ public:
|
||||
double dPingTime;
|
||||
double dPingWait;
|
||||
std::string addrLocal;
|
||||
// Address of this peer
|
||||
CAddress addr;
|
||||
// Bind address of our side of the connection
|
||||
// CAddress addrBind; // https://github.com/bitcoin/bitcoin/commit/a7e3c2814c8e49197889a4679461be42254e5c51
|
||||
uint32_t m_mapped_as;
|
||||
};
|
||||
|
||||
|
||||
@@ -303,7 +310,10 @@ public:
|
||||
int64_t nTimeConnected;
|
||||
int64_t nTimeOffset;
|
||||
uint32_t prevtimes[16];
|
||||
// Address of this peer
|
||||
CAddress addr;
|
||||
// Bind address of our side of the connection
|
||||
// const CAddress addrBind; // https://github.com/bitcoin/bitcoin/commit/a7e3c2814c8e49197889a4679461be42254e5c51
|
||||
std::string addrName;
|
||||
CService addrLocal;
|
||||
int nVersion;
|
||||
@@ -449,7 +459,7 @@ public:
|
||||
if (addr.IsValid() && !addrKnown.contains(addr.GetKey())) {
|
||||
if (vAddrToSend.size() >= MAX_ADDR_TO_SEND) {
|
||||
vAddrToSend[insecure_rand() % vAddrToSend.size()] = addr;
|
||||
} else {
|
||||
} else {
|
||||
vAddrToSend.push_back(addr);
|
||||
}
|
||||
}
|
||||
@@ -672,7 +682,7 @@ public:
|
||||
static bool Unban(const CSubNet &ip);
|
||||
static void GetBanned(std::map<CSubNet, int64_t> &banmap);
|
||||
|
||||
void copyStats(CNodeStats &stats);
|
||||
void copyStats(CNodeStats &stats, const std::vector<bool> &m_asmap);
|
||||
|
||||
static bool IsWhitelistedRange(const CNetAddr &ip);
|
||||
static void AddWhitelistedRange(const CSubNet &subnet);
|
||||
|
||||
Reference in New Issue
Block a user