Page MenuHomePhabricator

[p2p] No delay in adding fixed seeds if -dnsseed=0 and peers.dat is empty. Add -fixedseeds arg.
ClosedPublic

Authored by Fabien on Jan 26 2022, 15:22.

Details

Reviewers
PiRK
Group Reviewers
Restricted Project
Maniphest Tasks
Restricted Maniphest Task
Commits
rABC6974a58c0469: [p2p] No delay in adding fixed seeds if -dnsseed=0 and peers.dat is empty. Add…
Summary
Before PR: If peers.dat is empty and -dnsseed=0, bitcoind will fallback on to fixed seeds but only after a 60 seconds delay.
After PR: There's no 60 second delay.

To reproduce:
rm ~/.bitcoin/peers.dat && src/bitcoind -dnsseed=0 without and with patch code

Other changes in the PR:

    -fixedseeds command line argument added: -dnsseed=0 -fixedseeds=0 -addnode=X provides a trusted peer only setup. -dnsseed=0 -fixedseeds=0 allows for a addnode RPC to add a trusted peer without falling back to hardcoded seeds.

Note to reviewers 1: the p2p_dos_header_tree.py test change is cherry picked from https://github.com/bitcoin/bitcoin/pull/21254/commits/fa730e915766b012ff145e3c2af782668defb21f. Without this the test will connect to the real testnet and eventually sync the headers with other nodes, that would cause the test to fail. This will be undone when the PR is backported, which requires D10909 as a dependency.
Note to reviewers 2: the test feature_config_args.py now takes forever to run, this will be fixed in a follow-up.

Backport of core#19884.

Depends on D10907.

Ref T1696.

Test Plan
./test/functional/test_runner.py feature_config_args.py

Event Timeline

Fabien requested review of this revision.Jan 26 2022, 15:22

Failed tests logs:

====== Bitcoin ABC functional tests: p2p_dos_header_tree.py ======

------- Stdout: -------
2022-01-26T15:35:28.103000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-debug/test/tmp/test_runner_₿₵_  _20220126_153017/p2p_dos_header_tree_111
2022-01-26T15:35:28.719000Z TestFramework (INFO): Read headers data
2022-01-26T15:35:28.726000Z TestFramework (INFO): Feed all non-fork headers, including and up to the first checkpoint
2022-01-26T15:35:28.894000Z TestFramework (INFO): Feed all fork headers (fails due to checkpoint)
2022-01-26T15:35:28.995000Z TestFramework (INFO): Feed all fork headers (succeeds without checkpoint)
2022-01-26T15:35:30.104000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 132, in main
    self.run_test()
  File "/work/test/functional/p2p_dos_header_tree.py", line 82, in run_test
    msg_headers(self.headers_fork))
  File "/work/test/functional/test_framework/p2p.py", line 594, in send_and_ping
    self.sync_with_ping(timeout=timeout)
  File "/work/test/functional/test_framework/p2p.py", line 612, in sync_with_ping
    self.wait_until(test_function, timeout=timeout)
  File "/work/test/functional/test_framework/p2p.py", line 502, in wait_until
    timeout_factor=self.timeout_factor)
  File "/work/test/functional/test_framework/util.py", line 270, in wait_until_helper
    if predicate():
  File "/work/test/functional/test_framework/p2p.py", line 498, in test_function
    assert self.is_connected
AssertionError
2022-01-26T15:35:30.155000Z TestFramework (INFO): Stopping nodes
2022-01-26T15:35:30.508000Z TestFramework (WARNING): Not cleaning up dir /work/abc-ci-builds/build-debug/test/tmp/test_runner_₿₵_  _20220126_153017/p2p_dos_header_tree_111
2022-01-26T15:35:30.508000Z TestFramework (ERROR): Test failed. Test logging available at /work/abc-ci-builds/build-debug/test/tmp/test_runner_₿₵_  _20220126_153017/p2p_dos_header_tree_111/test_framework.log
2022-01-26T15:35:30.508000Z TestFramework (ERROR): 
2022-01-26T15:35:30.508000Z TestFramework (ERROR): Hint: Call /work/test/functional/combine_logs.py '/work/abc-ci-builds/build-debug/test/tmp/test_runner_₿₵_  _20220126_153017/p2p_dos_header_tree_111' to consolidate all logs
2022-01-26T15:35:30.508000Z TestFramework (ERROR): 
2022-01-26T15:35:30.508000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
2022-01-26T15:35:30.508000Z TestFramework (ERROR): https://github.com/Bitcoin-ABC/bitcoin-abc/issues
2022-01-26T15:35:30.508000Z TestFramework (ERROR):

Each failure log is accessible here:
Bitcoin ABC functional tests: p2p_dos_header_tree.py

Failed tests logs:

====== Bitcoin ABC functional tests: p2p_dos_header_tree.py ======

------- Stdout: -------
2022-01-26T15:35:35.912000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20220126_153158/p2p_dos_header_tree_111
2022-01-26T15:35:36.338000Z TestFramework (INFO): Read headers data
2022-01-26T15:35:36.344000Z TestFramework (INFO): Feed all non-fork headers, including and up to the first checkpoint
2022-01-26T15:35:36.511000Z TestFramework (INFO): Feed all fork headers (fails due to checkpoint)
2022-01-26T15:35:36.613000Z TestFramework (INFO): Feed all fork headers (succeeds without checkpoint)
2022-01-26T15:35:37.381000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 132, in main
    self.run_test()
  File "/work/test/functional/p2p_dos_header_tree.py", line 82, in run_test
    msg_headers(self.headers_fork))
  File "/work/test/functional/test_framework/p2p.py", line 594, in send_and_ping
    self.sync_with_ping(timeout=timeout)
  File "/work/test/functional/test_framework/p2p.py", line 612, in sync_with_ping
    self.wait_until(test_function, timeout=timeout)
  File "/work/test/functional/test_framework/p2p.py", line 502, in wait_until
    timeout_factor=self.timeout_factor)
  File "/work/test/functional/test_framework/util.py", line 270, in wait_until_helper
    if predicate():
  File "/work/test/functional/test_framework/p2p.py", line 498, in test_function
    assert self.is_connected
AssertionError
2022-01-26T15:35:37.432000Z TestFramework (INFO): Stopping nodes
2022-01-26T15:35:38.486000Z TestFramework (WARNING): Not cleaning up dir /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20220126_153158/p2p_dos_header_tree_111
2022-01-26T15:35:38.486000Z TestFramework (ERROR): Test failed. Test logging available at /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20220126_153158/p2p_dos_header_tree_111/test_framework.log
2022-01-26T15:35:38.486000Z TestFramework (ERROR): 
2022-01-26T15:35:38.487000Z TestFramework (ERROR): Hint: Call /work/test/functional/combine_logs.py '/work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20220126_153158/p2p_dos_header_tree_111' to consolidate all logs
2022-01-26T15:35:38.487000Z TestFramework (ERROR): 
2022-01-26T15:35:38.487000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
2022-01-26T15:35:38.487000Z TestFramework (ERROR): https://github.com/Bitcoin-ABC/bitcoin-abc/issues
2022-01-26T15:35:38.487000Z TestFramework (ERROR):
====== Bitcoin ABC functional tests with the next upgrade activated: p2p_dos_header_tree.py ======

------- Stdout: -------
2022-01-26T15:39:48.520000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20220126_153603/p2p_dos_header_tree_111
2022-01-26T15:39:48.871000Z TestFramework (INFO): Read headers data
2022-01-26T15:39:48.878000Z TestFramework (INFO): Feed all non-fork headers, including and up to the first checkpoint
2022-01-26T15:39:49.083000Z TestFramework (INFO): Feed all fork headers (fails due to checkpoint)
2022-01-26T15:39:49.184000Z TestFramework (INFO): Feed all fork headers (succeeds without checkpoint)
2022-01-26T15:39:49.997000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 132, in main
    self.run_test()
  File "/work/test/functional/p2p_dos_header_tree.py", line 82, in run_test
    msg_headers(self.headers_fork))
  File "/work/test/functional/test_framework/p2p.py", line 594, in send_and_ping
    self.sync_with_ping(timeout=timeout)
  File "/work/test/functional/test_framework/p2p.py", line 612, in sync_with_ping
    self.wait_until(test_function, timeout=timeout)
  File "/work/test/functional/test_framework/p2p.py", line 502, in wait_until
    timeout_factor=self.timeout_factor)
  File "/work/test/functional/test_framework/util.py", line 270, in wait_until_helper
    if predicate():
  File "/work/test/functional/test_framework/p2p.py", line 498, in test_function
    assert self.is_connected
AssertionError
2022-01-26T15:39:50.048000Z TestFramework (INFO): Stopping nodes
2022-01-26T15:39:50.351000Z TestFramework (WARNING): Not cleaning up dir /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20220126_153603/p2p_dos_header_tree_111
2022-01-26T15:39:50.351000Z TestFramework (ERROR): Test failed. Test logging available at /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20220126_153603/p2p_dos_header_tree_111/test_framework.log
2022-01-26T15:39:50.351000Z TestFramework (ERROR): 
2022-01-26T15:39:50.351000Z TestFramework (ERROR): Hint: Call /work/test/functional/combine_logs.py '/work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20220126_153603/p2p_dos_header_tree_111' to consolidate all logs
2022-01-26T15:39:50.352000Z TestFramework (ERROR): 
2022-01-26T15:39:50.352000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
2022-01-26T15:39:50.352000Z TestFramework (ERROR): https://github.com/Bitcoin-ABC/bitcoin-abc/issues
2022-01-26T15:39:50.352000Z TestFramework (ERROR):

Each failure log is accessible here:
Bitcoin ABC functional tests: p2p_dos_header_tree.py
Bitcoin ABC functional tests with the next upgrade activated: p2p_dos_header_tree.py

Fabien planned changes to this revision.Jan 26 2022, 19:30

Rebase, add a release note, and fix the test failure with a temporary fix (see summary)

PiRK requested changes to this revision.Jan 27 2022, 15:03
PiRK added a subscriber: PiRK.
PiRK added inline comments.
doc/release-notes.md
8
10
This revision now requires changes to proceed.Jan 27 2022, 15:03
doc/release-notes.md
10

Also The nodes need (no final s)

This revision is now accepted and ready to land.Jan 27 2022, 15:18