From 00b875ba9414463d0041da6924fd9b54d6a06dee Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 7 Jun 2021 12:45:35 +0200 Subject: 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. --- src/addrman.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/addrman.h') 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; }; -- cgit v1.2.3