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.
This commit is contained in:
Vasil Dimov
2021-06-07 12:45:35 +02:00
parent bdb62096f0
commit 00b875ba94
3 changed files with 77 additions and 0 deletions

View File

@@ -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;
};