mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-11 04:12:36 -03:00
p2p: add only reachable addresses to addrman
We will not make outgoing connection to peers that are unreachable (e.g. because of -onlynet configuration). Therefore, it makes no sense to add them to addrman in the first place. While this is already the case for addresses received via p2p addr messages, this commit does the same for addresses received from fixed seeds.
This commit is contained in:
parent
6dc3084eec
commit
91f0a7fbb7
1 changed files with 6 additions and 1 deletions
|
@ -1635,10 +1635,15 @@ void CConnman::ThreadOpenConnections(const std::vector<std::string> connect)
|
|||
}
|
||||
|
||||
if (add_fixed_seeds_now) {
|
||||
std::vector<CAddress> seed_addrs{ConvertSeeds(Params().FixedSeeds())};
|
||||
seed_addrs.erase(std::remove_if(seed_addrs.begin(), seed_addrs.end(),
|
||||
[](const CAddress& addr) { return !IsReachable(addr); }),
|
||||
seed_addrs.end());
|
||||
CNetAddr local;
|
||||
local.SetInternal("fixedseeds");
|
||||
addrman.Add(ConvertSeeds(Params().FixedSeeds()), local);
|
||||
addrman.Add(seed_addrs, local);
|
||||
add_fixed_seeds = false;
|
||||
LogPrintf("Added %d fixed seeds from reachable networks.\n", seed_addrs.size());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue