Edit `CTestNetParams` in `chainparams.cpp` to have `vSeeds.emplace_back("localhost");` as the only seed.
After each case remove the `dnsseed.dat`, `dnsseed.dump`, and `dnsstats.log` files from the directory you run `bitcoin-seeder` from if there are any. If you don't the seeder will not connect with the local host node right away.
ninja
ninja check-bitcoin-seeder
(1) This should basically be a node with only the genesis block.
mkdir genesisdir
./bitcoind --testnet -debug=net -datadir=genesisdir
Let the node run for a while to begin IBD.
./bitcoin-seeder -host=localhost -ns=blah.bitframe.org -port=8888 -mbox=info@bitframe.org --testnet --wipeban --wipeignore
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.
(2) This should be a node with an up-to-date chain.
./bitcoind --testnet -whitelist=127.0.0.1 -listen=1 -connect=0 -debug=net
./bitcoin-seeder -host=localhost -ns=blah.bitframe.org -port=8888 -mbox=info@bitframe.org --testnet --wipeban --wipeignore
Depending on the number of peers your node has you will see one of the two of the following as output from the seeder:
0/2 available (2 tried in 2s, 0 new, 0 active), 0 banned; 0 DNS requests, 0 db queries
if your node has no peers.
0/684 available (2 tried in 1s, 639 new, 43 active), 0 banned; 0 DNS requests, 0 db queries
if your node has peers.
If you leave the seeder running for long enough, the node's information should appear in `dnsseed.dump`
(3) An incomplete/partially invalidated chain:
./bitcoind --testnet -whitelist=127.0.0.1 -listen=1 -connect=0 -debug=net
./bitcoin-cli invalidateblock <hash of the block after the most recent checkpoint>
./bitcoin-seeder -host=localhost -ns=blah.bitframe.org -port=8888 -mbox=info@bitframe.org --testnet --wipeban --wipeignore
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)
./bitcoind --testnet -whitelist=127.0.0.1 -listen=1 -connect=0 -debug=net
./bitcoin-cli reconsider <hash of the block after the most recent checkpoint>
While the node is reorganizing:
./bitcoin-seeder -host=localhost -ns=blah.bitframe.org -port=8888 -mbox=info@bitframe.org --testnet --wipeban --wipeignore
0/741 available (2 tried in 1s, 707 new, 32 active), 0 banned; 0 DNS requests, 0 db queries
This node still accepts `GETADDRS` and `GETHEADERS` messages during reorg and should output the above.
(5)
./bitcoind --testnet -whitelist=127.0.0.1 -listen=1 -connect=0 -debug=net
./bitcoin-cli invalidateblock <hash of the most recent checkpoint>
./bitcoin-seeder -host=localhost -ns=blah.bitframe.org -port=8888 -mbox=info@bitframe.org --testnet --wipeban --wipeignore
This should behave similarly to (3):
0/722 available (2 tried in 1s, 672 new, 48 active), 0 banned; 0 DNS requests, 0 db queries
(6) Wrong chain
Undo the changes made in `chainparams.cpp`.
Between Line 194 and 195 of `bitcoin.cpp`, add:
```
if (checkpointState == CheckpointState::NotFound) {
tfm::format(std::cout, "%s: ########MISSING CHECKPOINT########", ToString(you).c_str());
}
```
Also after line 200 add:
```
if (res.nBanTime != 0) {
tfm::format(std::cout, "%s: banned", res.service.ToString().c_str());
}
```
ninja
./bitcoin-seeder -host=localhost -ns=blah.bitframe.org -port=8888 -mbox=info@bitframe.org --testnet --wipeban --wipeignore -dnsthreads=1 -threads=1
This will have the seeder start slowly crawling through the network as usual. Letting the seeder run will eventually have it connect with a node on the wrong chain causing the missing checkpoint message above to be printed to the console. After the missing checkpoint message, there the banned message should pop up. I found this to occur on `192.81.217.219:18333` relatively shortly after starting the seeder.