mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-12 21:52:53 +02:00
p2p: Assume v2transport for addresses from seeds
By now, the vast majority of nodes in the network supports BIP324.
Even if the optimistic guess would turn out to be wrong for a given
node, we would just reconnect with v1.
This is better than making v1 connections with peers when both nodes support v2.
Github-Pull: #35766
Rebased-From: cf0f2aeae0
This commit is contained in:
committed by
fanquake
parent
444f2d7965
commit
c02ff3e793
@@ -205,7 +205,7 @@ static std::vector<CAddress> ConvertSeeds(const std::vector<uint8_t> &vSeedsIn)
|
||||
while (!s.empty()) {
|
||||
CService endpoint;
|
||||
s >> endpoint;
|
||||
CAddress addr{endpoint, SeedsServiceFlags()};
|
||||
CAddress addr{endpoint, SeedsAssumedServiceFlags()};
|
||||
addr.nTime = rng.rand_uniform_delay(Now<NodeSeconds>() - one_week, -one_week);
|
||||
LogDebug(BCLog::NET, "Added hardcoded seed: %s\n", addr.ToStringAddrPort());
|
||||
vSeedsOut.push_back(addr);
|
||||
@@ -2382,7 +2382,7 @@ void CConnman::ThreadDNSAddressSeed()
|
||||
const auto addresses{LookupHost(host, nMaxIPs, true)};
|
||||
if (!addresses.empty()) {
|
||||
for (const CNetAddr& ip : addresses) {
|
||||
CAddress addr = CAddress(CService(ip, m_params.GetDefaultPort()), requiredServiceBits);
|
||||
CAddress addr = CAddress(CService(ip, m_params.GetDefaultPort()), SeedsAssumedServiceFlags());
|
||||
addr.nTime = rng.rand_uniform_delay(Now<NodeSeconds>() - 3 * 24h, -4 * 24h); // use a random age between 3 and 7 days old
|
||||
vAdd.push_back(addr);
|
||||
found++;
|
||||
|
||||
Reference in New Issue
Block a user