Seeder: Verify that nodes are on the correct chain
Summary
Since there have been 2 splits of the BCH chain that haven't modified their network magic, the seeder considers a lot of nodes as good that are actually on the wrong chain.
To fix this, the seeder will check the headers of all nodes synced
higher than the last checkpoint's height. To do this, a P2P getheaders
with the last checkpoint's hash as locator is sent, the first returned
header's previous block hash is compared to checkpoint's hash and the
node is banned if they do not match.
Depends on !1039 (merged)
Test plan
ninja check-bitcoin-seeder
- Uncomment the
wrong chain
print insrc/seeder/bitcoin.cpp
ninja
- Run a mainnet seeder
- Observe node versions being banned, should not include BCH nodes.
- Observe which nodes are ending up as good in
dnsseed.dump
:awk '{ if ($2 == 1) { print } }' dnsseed.dump
Edited by Axel Gembe