HomePhabricator

Dedup net message writing code in the seeder

Description

Dedup net message writing code in the seeder

Summary:
The message writing logic is duplicated in the seeder. Using the same code as the node
makes it easier to test, maintain, and add new message types for the seeder to support
(ie. header messages so that seeders can apply checkpoints).

Depends on D6355 and D8622

Test Plan:

ninja
ninja check-bitcoin-seeder

Edit chainparams.cpp to replace all seeds in TestNet with a single entry: vSeeds.emplace_back("localhost");

src/bitcoind -testnet -whitelist=127.0.0.1 -listen=1 -connect=0 -debug=net

Wait for the node to finish startng up

src/seeder/bitcoin-seeder -host=localhost -ns=blah.bitframe.org -port=8888 -mbox=info@bitframe.org -wipeban -wipeignore -testnet

From the seeder, the output should start as:

0/1 available (1 tried in 1s, 0 new, 0 active), 0 banned; 0 DNS requests, 0 db queries

And eventually become something like:

0/503 available (1 tried in 1s, 470 new, 32 active), 0 banned; 0 DNS requests, 0 db queries

Output from the node should be similar to the following:

Leaving InitialBlockDownload (latching to false)
Added connection peer=0
connection from 127.0.0.1:58994 accepted
received: version (111 bytes) peer=0
sending version (114 bytes) peer=0
send version message: version 70015, blocks=1383542, us=[::]:0, peer=0
Cleared nodestate for peer=0
sending verack (0 bytes) peer=0
receive version message: [127.0.0.1:58994] /bitcoin-cash-seeder:0.15/: version 70015, blocks=1378461, us=127.0.0.1:18333, peer=0
added time data, samples 2, offset +0 (+0 minutes)
received: verack (0 bytes) peer=0
sending sendheaders (0 bytes) peer=0
sending sendcmpct (9 bytes) peer=0
sending ping (8 bytes) peer=0
sending feefilter (8 bytes) peer=0
received: getaddr (0 bytes) peer=0
sending addr (30003 bytes) peer=0
socket closed
disconnecting peer=0
Cleared nodestate for peer=0

Reviewers: O1 Bitcoin ABC, #bitcoin_abc, deadalnix, nakihito

Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, deadalnix

Subscribers: deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D6357

Details

Provenance
nakihitoAuthored on Dec 7 2020, 18:16
jasonbcoxCommitted on Dec 10 2020, 00:06
jasonbcoxPushed on Dec 10 2020, 00:06
Reviewer
Restricted Owners Package
Differential Revision
D6357: Dedup net message writing code in the seeder
Parents
rABC912bd27d4b44: wallet: Never schedule MaybeCompactWalletDB when -flushwallet is off
Branches
Unknown
Tags
Unknown