This makes it easier to test both the node fetching seeds
from a particular seeder and a seeder fetching peers from a particular node.
Details
- Reviewers
deadalnix - Group Reviewers
Restricted Project - Commits
- rABC45d5037db635: Add -overridednsseed for testing DNS seed behavior
ninja check
Test node fetching seeds from a specific seeder:
bitcoind -overridednsseed=seed.bitcoinabc.org
Should see this in the logs:
2020-12-14T18:01:03Z Loading addresses from DNS seed seed.bitcoinabc.org 2020-12-14T18:01:03Z 24 addresses found from DNS seeds
Test seeder fetching peers from a specific node:
./bitcoind ./bitcoin-seeder -host=localhost -ns=localhost -port=8888 -mbox=noemail@bitcoinabc.org -wipeban -wipeignore -overridednsseed=localhost
After some time, the seeder should report many peers:
[20-12-14 10:29:17] 0/482 available (4 tried in 8s, 147 new, 331 active), 0 banned; 0 DNS requests, 0 db queries
Diff Detail
- Repository
- rABC Bitcoin ABC
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
The cppcheck issue appears to be a bug in cppcheck. Fabien has confirmed this lint error does not appear in a newer version.
src/chainparams.cpp | ||
---|---|---|
75 ↗ | (On Diff #26370) | The proper way to do this is to check if the arg is set. |
src/chainparams.cpp | ||
---|---|---|
75 ↗ | (On Diff #26418) | I think this returns a reference to something that is past its lifetime. |
- Rename DNSSeeds -> GetRandomizedDNSSeeds
- Make the currently node-specific randomization logic available to the seeder
- Doing the above also incidentally makes better use of the vector copy that I introduced in this patch.
src/seeder/main.cpp | ||
---|---|---|
467 ↗ | (On Diff #26618) | I'm aware this will copy on each loop. Not doing so eliminates any potential benefit from the randomization. This operation only occurs occasionally (see the sleep below), so the cost is minimal. |
src/chainparams.h | ||
---|---|---|
88 ↗ | (On Diff #26618) | This does not belong in the chain params. Make it a free function and keep the params dumb. |
Separated out GetRandomizedDNSSeeds into its own files. Over time, these new files can house the
DNS seed related logic and constants that currently reside in the net.h/cpp mess.