Page MenuHomePhabricator

Update Seeder to use ArgsManager
AbandonedPublic

Authored by nakihito on Oct 7 2019, 23:14.

Details

Reviewers
deadalnix
Fabien
jasonbcox
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Restricted Project
Summary

Seeder code is very old and was still using tools like getopt() to
read options. This change attempts to bring the seeder code more in
line with similar files (like bitcoind.cpp) in the code base and modernize the tools it
uses. To accomplish this, the CDnsSeedOpts class has been removed as its purpose
is made almost completely obsolete by ArgsManager.

Because ArgsManager does not seem to support both long and short
options and because it also reserves the -h option for help message
requests, the seeder's options have all been changed to long-form. This
is also more inline with our other code (for example, see bitcoind.cpp).

Depends on D4222

Test Plan
make
bitcoin-seeder -help
bitcoin-seeder -h
bitcoin-seeder -?

These should all output the seeder help message

./bitcoin-seeder -host=seeder.bitframe.org -ns=dev.bitframe.org -port=5364 -mbox=info@bitframe.org -testnet -filter=1,5 -wipeignore -wipeban -threads=95 -threads=5

This should start the seeder with the following lines:

Supporting whitelisted filters: 0x1,0x5
Using testnet.
Loading dnsseed.dat...Ban list wiped...Ignore list wiped...done
Starting 5 DNS threads for seeder.bitframe.org on dev.bitframe.org (port 5364)........done
Starting seeder...done
Starting 95 crawler threads...done
...

The third line above will only output if there is already a dnsseed.dat file in the directory the seeder is run from.

Diff Detail

Repository
rABC Bitcoin ABC
Branch
UpdateSeederHelp
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 7756
Build 13551: Bitcoin ABC Buildbot (legacy)
Build 13550: arc lint + arc unit

Event Timeline

nakihito created this revision.Oct 7 2019, 23:14
Owners added a reviewer: Restricted Owners Package.Oct 7 2019, 23:14
Herald added a reviewer: Restricted Project. · View Herald TranscriptOct 7 2019, 23:14
nakihito planned changes to this revision.Oct 7 2019, 23:14
nakihito updated this revision to Diff 13394.Oct 7 2019, 23:23

Fixed typo wipte -> wipe.

nakihito planned changes to this revision.Oct 7 2019, 23:28
nakihito edited the summary of this revision. (Show Details)
nakihito requested review of this revision.Oct 8 2019, 00:08
deadalnix requested changes to this revision.Oct 8 2019, 15:16

There was a nice separation between argument processing and application initialization before, now there isn't. This clearly makes the code worse.

src/seeder/main.cpp
377 ↗(On Diff #13394)

It is worth noting that this isn't present in other utilities we have, and yet, this parameter works. There must be something at play.

419 ↗(On Diff #13394)

Is that necessary? It doesn't look like there is a test plan for this.

546 ↗(On Diff #13394)

...

599 ↗(On Diff #13394)

Clearly, AppInit isn't doing simply initialization. In addition, why is that necessary?

This revision now requires changes to proceed.Oct 8 2019, 15:16

Ha, this also breaks single letter parameters names, without release notes or any documentation, because why wouldn't it?

nakihito planned changes to this revision.Oct 8 2019, 21:46
nakihito edited the summary of this revision. (Show Details)Oct 9 2019, 20:05
nakihito edited the test plan for this revision. (Show Details)
nakihito edited the test plan for this revision. (Show Details)Oct 9 2019, 20:29
nakihito updated this revision to Diff 13481.Oct 10 2019, 00:09

Completely removed CDnsSeedOpts class and some redundant variables. Also added release notes and edited README file to reflect changes relevant to users.

nakihito planned changes to this revision.Oct 10 2019, 00:09
nakihito updated this revision to Diff 13519.Oct 12 2019, 00:22

Rebased.

nakihito planned changes to this revision.Oct 12 2019, 00:38
nakihito updated this revision to Diff 13521.Oct 12 2019, 04:29

Removed AppInit() and moved functionality to main().

deadalnix requested changes to this revision.Oct 14 2019, 17:10

This is almost impossible to figure out if this patch missed something or not as it combine logic changes with refactoring.

It is introducing an inordinate amount of duplicated knowledge (how places needs to be changed is the default nuber of thread for dnsthreads needs to be updated for instance?).

You need to refactor the code in small steps in order to get to a place where moving to gArgs is a trivial change - however big it may be.

src/seeder/main.cpp
168 ↗(On Diff #13521)

There was a nice function validating the parameters before doing anything. Now the validation code and the initialization logic are all mixed up. This is a clear regression.

540 ↗(On Diff #13521)

threads is not a size_t, so why is the look counter a size_t ?

This revision now requires changes to proceed.Oct 14 2019, 17:10
nakihito planned changes to this revision.Oct 14 2019, 20:05
nakihito abandoned this revision.Nov 4 2019, 07:44