mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 10:43:19 -03:00
net: avoid unnecessary GetBindAddress() call
Our local (bind) address is already saved in `CNode::addrBind` and there is no need to re-retrieve it again with `GetBindAddress()`. Also, for I2P connections `CNode::addrBind` would contain our I2P address, but `GetBindAddress()` would return something like `127.0.0.1:RANDOM_PORT`.
This commit is contained in:
parent
7c224fdac4
commit
f6c267db3b
1 changed files with 1 additions and 3 deletions
|
@ -2606,9 +2606,7 @@ std::vector<CAddress> CConnman::GetAddresses(size_t max_addresses, size_t max_pc
|
|||
|
||||
std::vector<CAddress> CConnman::GetAddresses(CNode& requestor, size_t max_addresses, size_t max_pct)
|
||||
{
|
||||
SOCKET socket;
|
||||
WITH_LOCK(requestor.cs_hSocket, socket = requestor.hSocket);
|
||||
auto local_socket_bytes = GetBindAddress(socket).GetAddrBytes();
|
||||
auto local_socket_bytes = requestor.addrBind.GetAddrBytes();
|
||||
uint64_t cache_id = GetDeterministicRandomizer(RANDOMIZER_ID_ADDRCACHE)
|
||||
.Write(requestor.addr.GetNetwork())
|
||||
.Write(local_socket_bytes.data(), local_socket_bytes.size())
|
||||
|
|
Loading…
Add table
Reference in a new issue