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 -overridednsseed=localhost
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 output should be something similar to the above after receiving addrs.
(2) Up-to-date chain:
./bitcoind -testnet -overridednsseed=localhost -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, the node's information should appear in `dnsseed.dump`
(3) Incomplete chain:
./bitcoind -testnet -overridednsseed=localhost -whitelist=127.0.0.1 -listen=1 -connect=0
./bitcoin-cli -testnet invalidateblock <hash of the block before the most recent 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 -overridednsseed=localhost -whitelist=127.0.0.1 -listen=1 -connect=0
./bitcoin-cli -testnet invalidateblock <hash of the most recent 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