mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-10 10:52:31 -05:00
[net] Seed addr cache randomizer with port from binding address
This commit is contained in:
parent
f10e80b6e4
commit
3382905bef
1 changed files with 3 additions and 0 deletions
|
@ -2801,6 +2801,9 @@ std::vector<CAddress> CConnman::GetAddresses(CNode& requestor, size_t max_addres
|
||||||
uint64_t cache_id = GetDeterministicRandomizer(RANDOMIZER_ID_ADDRCACHE)
|
uint64_t cache_id = GetDeterministicRandomizer(RANDOMIZER_ID_ADDRCACHE)
|
||||||
.Write(requestor.ConnectedThroughNetwork())
|
.Write(requestor.ConnectedThroughNetwork())
|
||||||
.Write(local_socket_bytes.data(), local_socket_bytes.size())
|
.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();
|
.Finalize();
|
||||||
const auto current_time = GetTime<std::chrono::microseconds>();
|
const auto current_time = GetTime<std::chrono::microseconds>();
|
||||||
auto r = m_addr_response_caches.emplace(cache_id, CachedAddrResponse{});
|
auto r = m_addr_response_caches.emplace(cache_id, CachedAddrResponse{});
|
||||||
|
|
Loading…
Add table
Reference in a new issue