Page MenuHomePhabricator

Update seeder files to use fprintf() instead of printf()
ClosedPublic

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

Details

Summary

Using fprintf() allows us more control over where text is output to. This is especially relevant if we wish to change some of the output to a log file or stderr rather than the current behavior of outputting solely to stdout. It also better clarifies where the text is being output to making the code easier.

Scripted diff using
sed -i -e 's/printf(\"/fprintf(stdout,\"/g' ./seeder/*

Test Plan
make
bitcoin-seeder

Make sure seeder is outputting something like:

Supporting whitelisted filters: 0x1,0x5,0x11,0x15
No nameserver set. Not starting DNS server.
Loading dnsseed.dat...done
Starting seeder...done
Starting 96 crawler threads...2019-10-07T23:03:47Z connect() to [2001:67c:130c:254::46]:8333 failed: Cannot assign requested address (99)
...

bitcoin-seeder -h seeder.bitframe.org -n dev.bitframe.org -p 5364 -m info@bitframe.org --testnet

This should output something like:

Supporting whitelisted filters: 0x1,0x5,0x11,0x15
Using testnet.
Loading dnsseed.dat...done
Starting 4 DNS threads for seeder.bitframe.org on dev.bitframe.org (port 5364).......done
Starting seeder...done
Starting 96 crawler threads...2019-10-07T23:06:18Z connect() to [2001:67c:130c:254::46]:8333 failed: Cannot assign requested address (99)
...

Diff Detail

Repository
rABC Bitcoin ABC
Branch
UpdateSeederfprintf
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 7708
Build 13455: Bitcoin ABC Buildbot (legacy)
Build 13454: arc lint + arc unit

Event Timeline

Owners added a reviewer: Restricted Owners Package.Oct 7 2019, 23:08
nakihito requested review of this revision.Oct 8 2019, 00:07
deadalnix requested changes to this revision.Oct 8 2019, 14:56

What is the goal of this? Why does it depends on D4216?

This revision now requires changes to proceed.Oct 8 2019, 14:56
nakihito requested review of this revision.Oct 9 2019, 01:12
nakihito edited the summary of this revision. (Show Details)

Edited summary to better express the reasoning behind this change. Also removed unnecessary dependency.

This revision is now accepted and ready to land.Oct 12 2019, 13:09