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 -whitelist=127.0.0.1 -listen=1 -connect=0 -debug=net -datadir=<New data dir>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/20/726 available (2 tried in 4s0s, 0676 new, 048 active), 0 banned; 0 DNS requests, 0 db queries
The output should be something similar to the above. Specifically, the number of `tried` nodes should have increased.
(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 initially:
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.
1/5810/684 available (32 tried in 4s1s, 546639 new, 3243 active), 0 banned; 0 DNS requests, 0 db queries
if your node has peers.
The important part being that the number of `tried` should have increased and that there is still `0 banned`.
In the second case, if you let the seeder continue to run, the seeder should begin connecting with more nodes than just the localhost. This is because the seeder initially was only able to connect to localhost, but now has addresses for other nodes received from your localhost node. 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/3990/722 available (2 tried in 7s1s, 381672 new, 1648 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
0/493 available (1 tried in 4s, 348 new, 144 active), 0 banned; 0 DNS requests, 0 db queries./bitcoin-seeder -host=localhost -ns=blah.bitframe.org -port=8888 -mbox=info@bitframe.org --testnet --wipeban --wipeignore -dnsthreads=1 -threads=1
This node is considered to be either on the wrong chain or IBD since the HEADERS message it returns does not include a/the block after the most recent checkpointwill 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. Its addrs are acceptedAfter the missing checkpoint message, butthere the node is bannedbanned message should pop up.