aboutsummaryrefslogtreecommitdiff
path: root/src/addrman.h
diff options
context:
space:
mode:
authorVasil Dimov <vd@FreeBSD.org>2021-06-07 12:45:35 +0200
committerVasil Dimov <vd@FreeBSD.org>2021-06-07 14:42:11 +0200
commit00b875ba9414463d0041da6924fd9b54d6a06dee (patch)
tree76c98674e9d4881ef66da84d107aa05dd1a9f7c1 /src/addrman.h
parentbdb62096f0109b2ec76849d33d6cf7187dea299f (diff)
downloadbitcoin-00b875ba9414463d0041da6924fd9b54d6a06dee.tar.xz
addrman: remove invalid addresses when unserializing
The Tor v2 addresses, left over from when Tor v2 was supported will be unserialized as a dummy, invalid `::` (all zeros) IPv6 address. Remove them so that they do not take up space in addrman.
Diffstat (limited to 'src/addrman.h')
-rw-r--r--src/addrman.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/addrman.h b/src/addrman.h
index 41994288db..54ccd5f8f2 100644
--- a/src/addrman.h
+++ b/src/addrman.h
@@ -448,6 +448,8 @@ public:
LogPrint(BCLog::ADDRMAN, "addrman lost %i new and %i tried addresses due to collisions\n", nLostUnk, nLost);
}
+ RemoveInvalid();
+
Check();
}
@@ -756,6 +758,9 @@ private:
//! Update an entry's service bits.
void SetServices_(const CService &addr, ServiceFlags nServices) EXCLUSIVE_LOCKS_REQUIRED(cs);
+ //! Remove invalid addresses.
+ void RemoveInvalid() EXCLUSIVE_LOCKS_REQUIRED(cs);
+
friend class CAddrManTest;
};