Build + unit tests:
ninja bitcoin-seeder check-seeder
Manual tests:
cd build/src
Between each test, cleanup seeder files with:
rm dns*
(1) IBD:
mkdir ibdtest
./bitcoind -testnet -datadir=ibdtest
Let the node run for a while to begin IBD.
./bitcoin-seeder -host=localhost -ns=localhost -port=8888 -mbox=noemail@bitcoinabc.org --testnet --wipeban --wipeignore -overridednsseed=localhost
The seeder should attempt to connect to the localhost node.
0/726 available (2 tried in 0s, 676 new, 48 active), 0 banned; 0 DNS requests, 0 db queries
The outputNotably, `0/x available`, x should be something similar to the above after receiving addrscome larger than 2, and `x new` and `x active` should grow larger than 0.
(2) Up-to-date chain:
./bitcoind -testnet -whitelist=127.0.0.1 -listen=1 -connect=0
./bitcoin-seeder -host=localhost -ns=localhost -port=8888 -mbox=noemail@bitcoinabc.org --testnet --wipeban --wipeignore -overridednsseed=localhost
Output from the seeder should be similar to:
0/684 available (2 tried in 1s, 639 new, 43 active), 0 banned; 0 DNS requests, 0 db queries
If you leave the seeder running for long enough, `127.0.0.1` will appear in `dnsseed.dump`
(3) Incomplete chain:
./bitcoind -testnet -whitelist=127.0.0.1 -listen=1 -connect=0
./bitcoin-cli -testnet invalidateblock 000000000fc2ff8fc6585b71961c6ca0ecea24fa52746cb5484256019891e448 # the block before the Axion checkpoint
./bitcoin-seeder -host=localhost -ns=localhost -port=8888 -mbox=noemail@bitcoinabc.org --testnet --wipeban --wipeignore -overridednsseed=localhost
0/722 available (2 tried in 1s, 672 new, 48 active), 0 banned; 0 DNS requests, 0 db queries
The output should be something similar as above, specifically there should still be `0 banned`, the number of `tried` should have increased, and the number of available should have increased.
(4) Wrong chain:
./bitcoind -testnet -whitelist=127.0.0.1 -listen=1 -connect=0
./bitcoin-cli -testnet reconsiderblock 000000000fc2ff8fc6585b71961c6ca0ecea24fa52746cb5484256019891e448
./bitcoin-cli -testnet invalidateblock 00000000062c7f32591d883c99fc89ebe74a83287c0f2b7ffeef72e62217d40b # hash of the Axion checkpoint
./bitcoin-seeder -host=localhost -ns=localhost -port=8888 -mbox=noemail@bitcoinabc.org --testnet --wipeban --wipeignore -overridednsseed=localhost
0/722 available (2 tried in 1s, 672 new, 48 active), 0 banned; 0 DNS requests, 0 db queries
The banning logic is a bit hard to test here. This is mostly a sanity check that we still get peers from this node.