Page MenuHomePhabricator

p2p: Add DumpAnchors()
ClosedPublic

Authored by PiRK on Nov 23 2021, 17:00.

Details

Reviewers
majcosta
Group Reviewers
Restricted Project
Commits
rABCbc785db12907: p2p: Add DumpAnchors()
Summary

This is an implementation of #17326:

  • all (currently 2) outbound block-relay-only connections are dumped to anchors.dat file
  • on restart a node tries to connect to the addresses from anchors.dat

This PR prevents a type of eclipse attack when an attacker exploits a victim node restart to force it to connect to new, probably adversarial, peers.

This is a backport of core#17428 [1/7]
https://github.com/bitcoin/bitcoin/pull/17428/commits/567008d2a0c95bd972f4031f31647c493d1bc2e8

Test Plan

ninja

Event Timeline

PiRK requested review of this revision.Nov 23 2021, 17:00

Tail of the build log:

wallet_keypool.py                       | ✓ Passed  | 3 s
wallet_keypool_topup.py                 | ✓ Passed  | 4 s
wallet_keypool_topup.py --descriptors   | ✓ Passed  | 4 s
wallet_labels.py                        | ✓ Passed  | 3 s
wallet_labels.py --descriptors          | ✓ Passed  | 3 s
wallet_listreceivedby.py                | ✓ Passed  | 13 s
wallet_listsinceblock.py                | ✓ Passed  | 7 s
wallet_listtransactions.py              | ✓ Passed  | 13 s
wallet_multiwallet.py                   | ✓ Passed  | 84 s
wallet_multiwallet.py --usecli          | ✓ Passed  | 18 s
wallet_reorgsrestore.py                 | ✓ Passed  | 4 s
wallet_resendwallettransactions.py      | ✓ Passed  | 2 s
wallet_send.py                          | ✓ Passed  | 8 s
wallet_startup.py                       | ✓ Passed  | 3 s
wallet_txn_clone.py                     | ✓ Passed  | 3 s
wallet_txn_clone.py --mineblock         | ✓ Passed  | 4 s
wallet_txn_doublespend.py               | ✓ Passed  | 3 s
wallet_txn_doublespend.py --mineblock   | ✓ Passed  | 4 s
wallet_watchonly.py                     | ✓ Passed  | 2 s
wallet_watchonly.py --usecli            | ✓ Passed  | 2 s

ALL                                     | ✓ Passed  | 1484 s (accumulated) 
Runtime: 298 s

----------------------------------------------------------------------
Ran 10 tests in 0.172s

OK

[193/456] Running seeder test suite
PASSED: seeder test suite
[195/456] Test Bitcoin RPC authentication...
...
----------------------------------------------------------------------
Ran 3 tests in 0.018s

OK
[198/456] cd /work/contrib/devtools/chainparams && /usr/bin/python3.7 ./test_make_chainparams.py
.....
----------------------------------------------------------------------
Ran 5 tests in 0.001s

OK
[199/456] Running avalanche test suite
PASSED: avalanche test suite
[352/456] bitcoin: testing wallet_tests
FAILED: src/test/CMakeFiles/check-bitcoin-wallet_tests 
cd /work/abc-ci-builds/build-debug/src/test && /usr/bin/cmake -E make_directory /work/abc-ci-builds/build-debug/test/junit && /usr/bin/cmake -E make_directory /work/abc-ci-builds/build-debug/test/log && /usr/bin/cmake -E env /work/cmake/utils/log-and-print-on-failure.sh /work/abc-ci-builds/build-debug/test/log/bitcoin-wallet_tests.log /work/abc-ci-builds/build-debug/src/test/test_bitcoin --run_test=wallet_tests --logger=HRF,message:JUNIT,message,bitcoin-wallet_tests.xml --catch_system_errors=no
pure virtual method called
terminate called without an active exception
Aborted (core dumped)
[376/456] Running secp256k1 test suite
PASSED: secp256k1 test suite
[427/456] Running pow test suite
PASSED: pow test suite
[449/456] Running bitcoin-qt test suite
PASSED: bitcoin-qt test suite
[453/456] Running utility command for check-bitcoin-coins_tests
ninja: build stopped: cannot make progress due to previous errors.
Build build-debug failed with exit code 1
PiRK edited the summary of this revision. (Show Details)

rebase (unrelated wallet test failure)

This revision is now accepted and ready to land.Nov 23 2021, 22:12
This revision was automatically updated to reflect the committed changes.