[net] Seed addr cache randomizer with port from binding address

This commit is contained in:
dergoegge 2022-04-12 13:47:48 +02:00
parent f10e80b6e4
commit 3382905bef

View file

@ -2801,6 +2801,9 @@ std::vector<CAddress> CConnman::GetAddresses(CNode& requestor, size_t max_addres
uint64_t cache_id = GetDeterministicRandomizer(RANDOMIZER_ID_ADDRCACHE)
.Write(requestor.ConnectedThroughNetwork())
.Write(local_socket_bytes.data(), local_socket_bytes.size())
// For outbound connections, the port of the bound address is randomly
// assigned by the OS and would therefore not be useful for seeding.
.Write(requestor.IsInboundConn() ? requestor.addrBind.GetPort() : 0)
.Finalize();
const auto current_time = GetTime<std::chrono::microseconds>();
auto r = m_addr_response_caches.emplace(cache_id, CachedAddrResponse{});