Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

p2p: gives seednode priority over dnsseed if both are provided #28016

Merged
merged 2 commits into from
Apr 30, 2024

Conversation

sr-gi
Copy link
Member

@sr-gi sr-gi commented Jun 30, 2023

This is a follow-up of #27577

If both seednode and dnsseed are provided, the node will start a race between them in order to fetch data to feed the addrman.

This PR gives priority to seednode over dnsseed so if some nodes are provided as seeds, they can be tried before defaulting to the dnsseeds

@DrahtBot
Copy link
Contributor

DrahtBot commented Jun 30, 2023

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage

For detailed information about the code coverage, see the test coverage report.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK davidgumberg, cbergqvist, itornaza, achow101
Stale ACK tdb3

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #29641 (scripted-diff: Use LogInfo/LogDebug over LogPrintf/LogPrint by maflcko)
  • #29605 (net: Favor peers from addrman over fetching seednodes by sr-gi)
  • #26114 (net: Make AddrFetch connections to fixed seeds by mzumsande)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@DrahtBot DrahtBot added the P2P label Jun 30, 2023
@sr-gi
Copy link
Member Author

sr-gi commented Jun 30, 2023

I wanted to have an exit early strategy that will hand the logic back to dnsseed if all seednodes have been tried and no data has been added to the addrman. However, looks like checking if both m_nodes and m_addr_fetch are empty may not be sufficient (i.e. a node can be removed from m_addr_fetch, tried but not yet put at m_nodes. This seems to be specifically sensitive for privacy networks where the latency may be higher)

src/net.cpp Outdated
// Abort if we have spent enough time without reaching our target.
// Giving seed nodes 30 seconds so this does not become a race against fixedseeds (which
// triggers after a minute)
if (GetTime<std::chrono::seconds>() > start + std::chrono::seconds{30}) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Could use NodeClock::now() for new code? Also 30s should work for the constant.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be fixed in ac7ce24

@luke-jr
Copy link
Member

luke-jr commented Jul 4, 2023

If both are provided, I would expect both to be active in parallel, and complete even if the other succeeds...

@sr-gi
Copy link
Member Author

sr-gi commented Sep 14, 2023

If both are provided, I would expect both to be active in parallel, and complete even if the other succeeds...

Kindly add some rationale for that?

As I see it, if the user is changing a default (adding a seednode in this case) I'd make sense to prioritize that, especially in this case where the dnsseeds are more likely to provide a higher number of addresses for the node to pick up. Hence, the odds of the user selecting a peer from the seednode(s) that he has manually specified are lower

@luke-jr
Copy link
Member

luke-jr commented Sep 15, 2023

If both are provided, I would expect both to be active in parallel, and complete even if the other succeeds...

Kindly add some rationale for that?

If the user has specified both, presumably he wants both to be used...

@sr-gi
Copy link
Member Author

sr-gi commented Sep 15, 2023

If both are provided, I would expect both to be active in parallel, and complete even if the other succeeds...

Kindly add some rationale for that?

If the user has specified both, presumably he wants both to be used...

And they are, just not at the same time.

The same rationale applies to #27577, yet seednodes are prioritized over fixed seeds

@sr-gi
Copy link
Member Author

sr-gi commented Jan 29, 2024

Rebased to fix CI

src/net.cpp Outdated Show resolved Hide resolved
@davidgumberg
Copy link
Contributor

davidgumberg commented Mar 15, 2024

ACK 78482a0

I ran into this issue with the existing behavior when testing -seednode over v2. To state more explicitly the problem with allowing both to run in parallel, it seems to me that populating from the dns seeds will almost always be faster than the time it takes to handshake and getaddr from a -seednode

Testing with a fresh signet node:

$ bitcoind -debug=net -signet -seednode=bitcoin.achow101.com:38333 -datadir=/tmp/28016/

On master

$ bitcoind -debug=net -signet -seednode=bitcoin.achow101.com:38333 -datadir=/tmp/28016/
2024-03-15T21:22:57Z init message: Starting network threads…
2024-03-15T21:22:57Z net thread start
2024-03-15T21:22:57Z addcon thread start
2024-03-15T21:22:57Z dnsseed thread start
2024-03-15T21:22:57Z Loading addresses from DNS seed seed.signet.bitcoin.sprovoost.nl.
2024-03-15T21:22:57Z opencon thread start
2024-03-15T21:22:57Z [net] trying v2 connection bitcoin.achow101.com:38333 lastseen=0.0hrs
2024-03-15T21:22:57Z init message: Done loading
2024-03-15T21:22:57Z msghand thread start
2024-03-15T21:22:57Z Loading addresses from DNS seed 178.128.221.177
2024-03-15T21:22:57Z Loading addresses from DNS seed v7ajjeirttkbnt32wpy3c6w3emwnfr3fkla7hpxcfokr3ysd3kqtzmqd.onion:38333
2024-03-15T21:22:57Z 34 addresses found from DNS seeds
2024-03-15T21:22:57Z dnsseed thread exit
2024-03-15T21:22:57Z [net] Added connection peer=0
2024-03-15T21:22:57Z [net] sending version (103 bytes) peer=0
2024-03-15T21:22:57Z [net] send version message: version 70016, blocks=0, txrelay=1, peer=0
2024-03-15T21:22:57Z [net] start sending v2 handshake to peer=0
2024-03-15T21:22:57Z [net] received: version (103 bytes) peer=0
2024-03-15T21:22:57Z [net] sending wtxidrelay (0 bytes) peer=0
2024-03-15T21:22:57Z [net] sending sendaddrv2 (0 bytes) peer=0
2024-03-15T21:22:57Z [net] sending verack (0 bytes) peer=0
2024-03-15T21:22:57Z [net] sending getaddr (0 bytes) peer=0
2024-03-15T21:22:57Z [net] receive version message: /Satoshi:27.99.0/: version 70016, blocks=186938, us=192.12.14.3:16482, txrelay=1, peer=0
2024-03-15T21:22:57Z [net] added time data, samples 2, offset +0 (+0 minutes)
2024-03-15T21:22:57Z [net] received: wtxidrelay (0 bytes) peer=0
2024-03-15T21:22:57Z [net] received: sendaddrv2 (0 bytes) peer=0
2024-03-15T21:22:57Z [net] received: verack (0 bytes) peer=0
2024-03-15T21:22:57Z New addr-fetch v2 peer connected: version: 70016, blocks=186938, peer=0
2024-03-15T21:22:57Z [net] sending sendcmpct (9 bytes) peer=0
2024-03-15T21:22:57Z [net] sending ping (8 bytes) peer=0
2024-03-15T21:22:57Z [net] sending feefilter (8 bytes) peer=0
2024-03-15T21:22:57Z [net] received: sendcmpct (9 bytes) peer=0
2024-03-15T21:22:57Z [net] received: ping (8 bytes) peer=0
2024-03-15T21:22:57Z [net] sending pong (8 bytes) peer=0
2024-03-15T21:22:57Z [net] received: getheaders (965 bytes) peer=0
2024-03-15T21:22:57Z [net] Ignoring getheaders from peer=0 because active chain has too little work; sending empty response
2024-03-15T21:22:57Z [net] sending headers (1 bytes) peer=0
2024-03-15T21:22:57Z [net] received: feefilter (8 bytes) peer=0
2024-03-15T21:22:57Z [net] received: feefilter of 0.00001000 BTC/kvB from peer=0
2024-03-15T21:22:57Z [net] received: addrv2 (19609 bytes) peer=0
2024-03-15T21:22:57Z [net] Received addr: 1000 addresses (1000 processed, 0 rate-limited) from peer=0
2024-03-15T21:22:57Z [net] addrfetch connection completed peer=0; disconnecting
2024-03-15T21:22:57Z [net] disconnecting peer=0
2024-03-15T21:22:57Z [net] Cleared nodestate for peer=0

On this branch:

$ bitcoind -signet -seednode=bitcoin.achow101.com:38333 -datadir=/tmp/28016/
2024-03-15T21:31:46Z -seednode enabled. Trying the provided seeds for 30 seconds before defaulting to the dnsseeds.
2024-03-15T21:31:46Z addcon thread start
2024-03-15T21:31:46Z opencon thread start
2024-03-15T21:31:46Z init message: Done loading
2024-03-15T21:31:46Z [net] trying v2 connection bitcoin.achow101.com:38333 lastseen=0.0hrs
2024-03-15T21:31:46Z msghand thread start
2024-03-15T21:31:46Z [net] Added connection peer=0
2024-03-15T21:31:46Z [net] sending version (103 bytes) peer=0
2024-03-15T21:31:46Z [net] send version message: version 70016, blocks=0, txrelay=1, peer=0
2024-03-15T21:31:46Z [net] start sending v2 handshake to peer=0
2024-03-15T21:31:46Z [net] received: version (103 bytes) peer=0
2024-03-15T21:31:46Z [net] sending wtxidrelay (0 bytes) peer=0
2024-03-15T21:31:46Z [net] sending sendaddrv2 (0 bytes) peer=0
2024-03-15T21:31:46Z [net] sending verack (0 bytes) peer=0
2024-03-15T21:31:46Z [net] sending getaddr (0 bytes) peer=0
2024-03-15T21:31:46Z [net] receive version message: /Satoshi:27.99.0/: version 70016, blocks=186940, us=192.12.14.3:44748, txrelay=1, peer=0
2024-03-15T21:31:46Z [net] added time data, samples 2, offset +0 (+0 minutes)
2024-03-15T21:31:46Z [net] received: wtxidrelay (0 bytes) peer=0
2024-03-15T21:31:46Z [net] received: sendaddrv2 (0 bytes) peer=0
2024-03-15T21:31:46Z [net] received: verack (0 bytes) peer=0
2024-03-15T21:31:46Z New addr-fetch v2 peer connected: version: 70016, blocks=186940, peer=0
2024-03-15T21:31:46Z [net] sending sendcmpct (9 bytes) peer=0
2024-03-15T21:31:46Z [net] sending ping (8 bytes) peer=0
2024-03-15T21:31:46Z [net] sending feefilter (8 bytes) peer=0
2024-03-15T21:31:46Z [net] received: sendcmpct (9 bytes) peer=0
2024-03-15T21:31:46Z [net] received: ping (8 bytes) peer=0
2024-03-15T21:31:46Z [net] sending pong (8 bytes) peer=0
2024-03-15T21:31:46Z [net] received: getheaders (965 bytes) peer=0
2024-03-15T21:31:46Z [net] Ignoring getheaders from peer=0 because active chain has too little work; sending empty response
2024-03-15T21:31:46Z [net] sending headers (1 bytes) peer=0
2024-03-15T21:31:46Z [net] received: feefilter (8 bytes) peer=0
2024-03-15T21:31:46Z [net] received: feefilter of 0.00001000 BTC/kvB from peer=0
2024-03-15T21:31:46Z [net] received: addrv2 (19594 bytes) peer=0
2024-03-15T21:31:46Z [net] Received addr: 999 addresses (999 processed, 0 rate-limited) from peer=0
2024-03-15T21:31:46Z [net] addrfetch connection completed peer=0; disconnecting
2024-03-15T21:31:46Z [net] disconnecting peer=0
2024-03-15T21:31:46Z [net] Cleared nodestate for peer=0
2024-03-15T21:31:47Z [net] trying v1 connection [2620:0:e00:400f::2c5]:38333 lastseen=196.1hrs
2024-03-15T21:31:47Z [net] connect() to [2620:0:e00:400f::2c5]:38333 failed: Network is unreachable (101)
2024-03-15T21:31:47Z [net] trying v1 connection [2a01:4f9:3a:2dd2::2]:38333 lastseen=15.0hrs
# [Later...]
2024-03-15T21:31:55Z P2P peers available. Finished fetching data from seed nodes.
2024-03-15T21:31:55Z Skipping DNS seeds. Enough peers have been found
2024-03-15T21:31:55Z dnsseed thread exit

@sr-gi
Copy link
Member Author

sr-gi commented Mar 18, 2024

We only try one new connection at a time, waiting 5 seconds for timeout before moving on to the next. Might be good to at least try 2 connections in parallel?

I'm not too familiar with the underlying logic for making the actual connection, but the higher level logic is designed around always having a max number of connections, that is: there is logic for filling the connections slots, and the logic to maintain, evict, and favor different kind of connections once the limit is reached. I don't think there is a real rush to fill the outbound connection slots, it happens rather quickly under normal conditions (with a populated addrman), so the case that it may take slightly longer on the first bootstrap shouldn't be an issue.

Maybe there would be some way for the second node to better prioritize which addresses it propagates so they're a bit less likely to fail. But also, maybe failures are to be expected if my two nodes are running behind the same external IP.

I don't think this would be a good idea. The collection of addresses that other peers feed you when requested is purposely "untested" (as in, not giving you information of whether they are good, or not giving you only good addresses is a feature). The reason for that is that if a seed only provides valid/tested addresses, you could tell what peers the node is connected to/has been connected to, which is undesirable

@sr-gi
Copy link
Member Author

sr-gi commented Mar 18, 2024

Addresses review comments by @davidgumberg

@itornaza
Copy link

tested ACK 2842e51

Standard tests

  • Did a code review
  • Configured with --with-incompatible-bdb and --enable-suppress-external-warnings
  • Run unit tests with make check and all tests pass
  • Run all functional tests with no extra flags and all tests pass
  • Run all functional tests with --extended and all tests pass

Manual functional test

Repeated a similar manual functional testing methodology to @davidgumberg and @cbergqvist on both testnet and signet, and again the expected behavior described in this PR is confirmed. For brevity I only include the testnet examples.

Test case 1: Valid seed node

  • Removed the peers.dat, anchors.dat and debug.log to start on a clean state with no known peers.
  • Run bitcoind with the following parameters set in bitcoin.conf for a run with a valid seed node.
testnet=1
seednode=testnet-seed.bitcoin.jonasschnelli.ch
debug=net
The seed node provided is used upfront and subsequent connections to peers follow suit
2024-03-23T13:30:08Z Bitcoin Core version v26.99.0-2842e51a246b (release build)
2024-03-23T13:30:08Z Config file arg: debug="net"
2024-03-23T13:30:08Z Config file arg: loglevel="debug"
2024-03-23T13:30:08Z Config file arg: seednode="testnet-seed.bitcoin.jonasschnelli.ch"
2024-03-23T13:30:08Z Config file arg: testnet="1"
...
2024-03-23T13:30:15Z net thread start
2024-03-23T13:30:15Z dnsseed thread start
2024-03-23T13:30:15Z opencon thread start
**2024-03-23T13:30:15Z -seednode enabled. Trying the provided seeds for 30 seconds before defaulting to the dnsseeds.**
2024-03-23T13:30:15Z init message: Done loading
2024-03-23T13:30:15Z Progress loading mempool transactions from disk: 71% (tried 5, 2 remaining)
**2024-03-23T13:30:15Z [net] trying v2 connection testnet-seed.bitcoin.jonasschnelli.ch lastseen=0.0hrs**
2024-03-23T13:30:15Z addcon thread start
2024-03-23T13:30:15Z msghand thread start
2024-03-23T13:30:15Z Progress loading mempool transactions from disk: 85% (tried 6, 1 remaining)
2024-03-23T13:30:15Z Imported mempool transactions from disk: 7 succeeded, 0 failed, 0 expired, 0 already there, 0 waiting for initial broadcast
2024-03-23T13:30:15Z initload thread exit
2024-03-23T13:30:15Z [net] Added connection peer=0
2024-03-23T13:30:15Z [net] sending version (103 bytes) peer=0
2024-03-23T13:30:15Z [net] send version message: version 70016, blocks=2582929, txrelay=1, peer=0
2024-03-23T13:30:15Z [net] start sending v2 handshake to peer=0
2024-03-23T13:30:15Z [net] socket closed for peer=0
2024-03-23T13:30:15Z [net] disconnecting peer=0
2024-03-23T13:30:15Z [net] retrying with v1 transport protocol for peer=0
2024-03-23T13:30:15Z [net] Cleared nodestate for peer=0
2024-03-23T13:30:16Z [net] trying v1 connection testnet-seed.bitcoin.jonasschnelli.ch lastseen=0.0hrs
2024-03-23T13:30:16Z [net] Added connection peer=1
2024-03-23T13:30:16Z [net] sending version (103 bytes) peer=1
2024-03-23T13:30:16Z [net] send version message: version 70016, blocks=2582929, txrelay=1, peer=1
2024-03-23T13:30:16Z [net] received: version (102 bytes) peer=1
2024-03-23T13:30:16Z [net] sending wtxidrelay (0 bytes) peer=1
2024-03-23T13:30:16Z [net] sending sendaddrv2 (0 bytes) peer=1
2024-03-23T13:30:16Z [net] sending verack (0 bytes) peer=1
2024-03-23T13:30:16Z [net] sending getaddr (0 bytes) peer=1
2024-03-23T13:30:16Z [net] receive version message: /Satoshi:25.1.0/: version 70016, blocks=2583188, us=185.51.134.196:54427, txrelay=1, peer=1
2024-03-23T13:30:16Z [net] added time data, samples 2, offset +0 (+0 minutes)
2024-03-23T13:30:16Z [net] received: wtxidrelay (0 bytes) peer=1
2024-03-23T13:30:16Z [net] received: sendaddrv2 (0 bytes) peer=1
2024-03-23T13:30:16Z [net] received: verack (0 bytes) peer=1
2024-03-23T13:30:16Z New addr-fetch v1 peer connected: version: 70016, blocks=2583188, peer=1
...

Test case 2: Invalid seed node

  • Again, removed the peers.dat, anchors.dat and debug.log to start on a clean state with no known peers.
  • Run bitcoind with the following parameters set in bitcoin.conf for a run with an invalid seed node.
testnet=1
seednode=192.168.1.46
debug=net
Connection to the seed node is given 30 sec to connect but it fails as it is invalid. Upon the expiration of this delay control is handed over to DNS seeds
2024-03-23T13:33:59Z Bitcoin Core version v26.99.0-2842e51a246b (release build)
...
2024-03-23T13:33:59Z Config file arg: debug="net"
2024-03-23T13:33:59Z Config file arg: loglevel="debug"
2024-03-23T13:33:59Z Config file arg: seednode="192.168.1.46"
2024-03-23T13:33:59Z Config file arg: testnet="1"
...
2024-03-23T13:34:06Z net thread start
2024-03-23T13:34:06Z addcon thread start
2024-03-23T13:34:06Z dnsseed thread start
2024-03-23T13:34:06Z opencon thread start
2024-03-23T13:34:06Z init message: Done loading
2024-03-23T13:34:06Z -seednode enabled. Trying the provided seeds for 30 seconds before defaulting to the dnsseeds.
2024-03-23T13:34:06Z [net] trying v2 connection 192.168.1.46 lastseen=0.0hrs
2024-03-23T13:34:06Z msghand thread start
2024-03-23T13:34:06Z [net] connect() to 192.168.1.46:18333 failed after wait: Connection refused (61)
...
...           ***  the process waits for 30s until handing over to DNS seed ***
...           ***  as is evident by the previous and next timestamps     ***
...
2024-03-23T13:34:36Z Couldn't connect to enough peers via seed nodes. Handing fetch logic to the DNS seeds.
...
2024-03-23T13:34:36Z Loading addresses from DNS seed testnet-seed.bitcoin.jonasschnelli.ch.
2024-03-23T13:34:36Z Loading addresses from DNS seed testnet-seed.bluematt.me.
2024-03-23T13:34:36Z Loading addresses from DNS seed seed.testnet.bitcoin.sprovoost.nl.
2024-03-23T13:34:36Z Loading addresses from DNS seed seed.tbtc.petertodd.net.
2024-03-23T13:34:36Z 46 addresses found from DNS seeds
2024-03-23T13:34:36Z dnsseed thread exit
...

@mzumsande
Copy link
Contributor

I wonder if it wouldn't be simpler to just disable dns seeds in InitParameterInteraction if -seednode was specified:

My main use case for -seenode would be as a backup option to use if I thought that there was something wrong with the dns seeds, e.g. if I thought they might be compromised or not working. In that case, having the DNS seeds as a backup option for seednode wouldn't really make sense: I'd rather not find any peers and be able to manually select another seednode if the -seednode peer I specified wasn't available.

In general, results from working dns seeds will be of better quality (in terms of percentage of peers you can actually connect to), because those specifically return peers that were reachable during the last minutes / hours, whereas GETADDR / ADDR does not filter for that.

I'm not sure about other people's use case though, so I wonder if there is a common use case for DNS seeds being backup to -seednode?

@sr-gi
Copy link
Member Author

sr-gi commented Apr 2, 2024

I wonder if it wouldn't be simpler to just disable dns seeds in InitParameterInteraction if -seednode was specified

I'm not sure about other people's use case though, so I wonder if there is a common use case for DNS seeds being backup to -seednode?

Yeah, me neither to be honest. My intuition is that if a non-default config is provided (and a default is not disabled), the user may want to give priority over the manual default, but still use the default as a last resort.

Given dns seeds are usually faster feeding addresses than seednodes are (due to a dns query vs a p2p oneshot) I leaned towards the current approach.

@davidgumberg
Copy link
Contributor

reACK 2842e51

I think the 30 second dns seed fallback condition here is more likely than I assumed because of the low quality of P2P gossip addresses mentioned by mzumsande above. I experienced it on my first test of this branch on signet and decided to investigate:

In my testing, 6 out of 12 attempts to bootstrap a signet node with a -seednode fell back to DNS seeds, and 7 out of 12 attempts to bootstrap a mainnet node fell back to DNS seeds.

It's a bit difficult for me to imagine a use case where someone would want to use -seednode without -dnsseed=0, but I feel disabling dns seeds / fixed seeds when the seednode argument is used would be surprising behavior.

Balancing the surprise of using -seednode and your node completely failing to bootstrap against using -seednode and having your node fall back to dns seeds / fixed seeds, I think this PR has it right since if our seed node is up, we at least populate our addrman with addresses from the seed node, mitigating some of the risks someone concerned about the DNS seeds would have, but I don't feel strongly one way or the other.

@tdb3
Copy link
Contributor

tdb3 commented Apr 6, 2024

re-ACK for 2842e51

The code adjustments made to bound scope and increase declaration/usage proximity look great to me (cleaner, more readable). Overall, I think the approach of this PR (prioritize seednodes before dnsseeds, then use dnsseeds if seednode usage was unsuccessful) is appropriate. Although subjective, overall I would consider node network reachability/health a bit more important than privacy. The parameter descriptions seem clear enough to enable a user to enhance privacy (e.g. disable dnsseed).

Built and ran all functionals (all passed).

Cleared datadir (with the exception of bitcoin.conf, chainstate, and blocks). Performed >1000 block download on signet to a reachable public node specified as a seednode. dnsseeds seemed to be avoided as expected.

2024-04-06T13:15:52Z dnsseed thread start
2024-04-06T13:15:52Z -seednode enabled. Trying the provided seeds for 30 seconds before defaulting to the dnsseeds.
...
2024-04-06T13:15:52Z New addr-fetch v2 peer connected: version: 70016, blocks=190136, peer=0
2024-04-06T13:15:59Z New outbound-full-relay v1 peer connected: version: 70016, blocks=190136, peer=1
2024-04-06T13:16:00Z Synchronizing blockheaders, height: 190136 (~100.00%)
2024-04-06T13:16:00Z UpdateTip: new best=00000104b1e879664a5b1706ef903e9647f6d156b67b2949bd17a7cc4e32c535 height=189083 version=0x20000000 log2_work=41.093842 tx=3272864 date='2024-03-30T12:13:51Z' progress=0.999366 cache=0.3MiB(1314txo)
...
2024-04-06T13:16:17Z UpdateTip: new best=0000001d2abdd48d80cb96fd4b2d36625af36ea3abb441069b05cb8c22d9ea6c height=190136 version=0x20000000 log2_work=41.102275 tx=3313628 date='2024-04-06T13:14:43Z' progress=1.000000 cache=13.0MiB(95511txo)
2024-04-06T13:16:17Z New outbound-full-relay v1 peer connected: version: 70016, blocks=190136, peer=3
2024-04-06T13:16:17Z P2P peers available. Finished fetching data from seed nodes.
2024-04-06T13:16:17Z Skipping DNS seeds. Enough peers have been found
2024-04-06T13:16:17Z dnsseed thread exit

Cleared datadir again and performed test with a known invalid seednode specified (i.e. purposefully specified an invalid port node for the previous public node used).
The invalid seednode was tried for 30 seconds, then dnsseeds were used (as expected).

2024-04-06T13:23:50Z dnsseed thread start
2024-04-06T13:23:50Z addcon thread start
2024-04-06T13:23:50Z -seednode enabled. Trying the provided seeds for 30 seconds before defaulting to the dnsseeds.
2024-04-06T13:23:50Z opencon thread start
2024-04-06T13:23:50Z msghand thread start
2024-04-06T13:23:50Z init message: Done loading
2024-04-06T13:24:20Z Couldn't connect to enough peers via seed nodes. Handing fetch logic to the DNS seeds.
2024-04-06T13:24:20Z Loading addresses from DNS seed v7ajjeirttkbnt32wpy3c6w3emwnfr3fkla7hpxcfokr3ysd3kqtzmqd.onion:38333
2024-04-06T13:24:20Z Loading addresses from DNS seed seed.signet.bitcoin.sprovoost.nl.
2024-04-06T13:24:20Z Cannot create socket for v7ajjeirttkbnt32wpy3c6w3emwnfr3fkla7hpxcfokr3ysd3kqtzmqd.onion:38333: unsupported network
2024-04-06T13:24:21Z Loading addresses from DNS seed 178.128.221.177
2024-04-06T13:24:21Z 34 addresses found from DNS seeds
2024-04-06T13:24:21Z dnsseed thread exit
2024-04-06T13:24:22Z New outbound-full-relay v1 peer connected: version: 70016, blocks=190138, peer=0
2024-04-06T13:24:22Z Leaving InitialBlockDownload (latching to false)
2024-04-06T13:24:44Z New outbound-full-relay v1 peer connected: version: 70016, blocks=190138, peer=1
2024-04-06T13:24:49Z New outbound-full-relay v1 peer connected: version: 70016, blocks=190138, peer=2
2024-04-06T13:24:55Z New outbound-full-relay v1 peer connected: version: 70016, blocks=190138, peer=3
2024-04-06T13:24:56Z New outbound-full-relay v1 peer connected: version: 70016, blocks=190138, peer=4
2024-04-06T13:24:56Z New outbound-full-relay v1 peer connected: version: 70016, blocks=190138, peer=5

@cbergqvist
Copy link
Contributor

ACK 2842e51

Diffed top 2 commits in that and 78482a0 which I previously tested & acked. Only scope of start-variable was narrowed as suggested by @davidgumberg in #28016 (comment).

@sr-gi
Copy link
Member Author

sr-gi commented Apr 22, 2024

Rebased to address merge conflicts

@davidgumberg
Copy link
Contributor

davidgumberg commented Apr 28, 2024

untested reACK 82f41d7

Copy link
Contributor

@cbergqvist cbergqvist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 82f41d7

After checking out ran: git range-diff 2842e51~2..2842e51 HEAD~2..HEAD
Functional including --extended tests passed (skipped unrelated feature_dbcrash).

@itornaza
Copy link

itornaza commented Apr 29, 2024

tested re-ACK 82f41d7

This PR not only adds meaningful functionality by enabling seeds that are provided by the user to take precedence over the default DNS seeds, but also enhances user experience with relevant reporting on what exactly happens through the process of connecting to the P2P network and which type of nodes are effectively used.

Built this PR from a cleaned up environment using make distclean and checked out the latest commit to test upon. Manually examined the differences using git difftool to inspect the code two commits back and it looks good to me.

I also run all unit, functional, extended and manual tests exactly as I described them in my previous #28016 (comment) and all pass.

@achow101
Copy link
Member

ACK 82f41d7

@achow101 achow101 merged commit 326e563 into bitcoin:master Apr 30, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants