Page MenuHomePhabricator

Seeder bans nodes not following the correct chain
Changes PlannedPublic

Authored by nakihito on Nov 14 2019, 04:39.

Details

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

Seeder does not currently distinguish between whether or not a node is
following the correct chain or not. This is a step in that direction by
making the seeder ban nodes that are do not have the latest checkpoint
in its chain. To do this, this patch allows the seeder to send GETHEADER
messages thereby activating code introduces earlier.

Depends on D4439

Test Plan

Edit the CTestNetParams class in chainparams.cpp to have vSeeds.emplace_back("localhost"); as the only seed.

ninja check
./bitcoind --printtoconsole --testnet -whitelist=127.0.0.1 -listen=1 -connect=0 -debug=net -datadir=<New data dir>
./bitcoin-seeder -h localhost -n blah.bitframe.org -p 8888 -m info@bitframe.org --testnet -wipeban -wipeignore

The seeder should attempt to connect to the localhost node. The node
should then be banned because its chain is not up to date and it replied
with an empty header message.

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

The seeder should output something like the above line.

Assuming you're testnet chain is up-to-date:

./bitcoind --printtoconsole --testnet -whitelist=127.0.0.1 -listen=1 -connect=0 -debug=net
./bitcoin-seeder -h localhost -n blah.bitframe.org -p 8888 -m info@bitframe.org --testnet -wipeban -wipeignore

The seeder should attempt to connect to the localhost node. The node
should reply with a non-empty headers message and then continue to
receive an addr message from the seeder. It should then start
connecting to various other addresses received from the seeder.

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

Seeder should output something like the above line after being successful.

Diff Detail

Repository
rABC Bitcoin ABC
Branch
SendNewMsgForSeeder
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 9409
Build 16747: Bitcoin ABC Buildbot
Build 16746: arc lint + arc unit

Event Timeline

nakihito created this revision.Nov 14 2019, 04:39
Owners added a reviewer: Restricted Owners Package.Nov 14 2019, 04:39
Herald added a reviewer: Restricted Project. · View Herald TranscriptNov 14 2019, 04:39
nakihito planned changes to this revision.Nov 14 2019, 04:40
nakihito requested review of this revision.Nov 14 2019, 04:42
deadalnix requested changes to this revision.Nov 14 2019, 14:57

I don't see any filtering going on anywhere is that patch.

src/seeder/bitcoin.cpp
108 ↗(On Diff #14124)

Function is called RequestChainPrams, doesn't request chain params.

114 ↗(On Diff #14124)

You wouldn't have to do this is you actually used the chain params.

121 ↗(On Diff #14124)

What does this do?

This revision now requires changes to proceed.Nov 14 2019, 14:57
nakihito edited the summary of this revision. (Show Details)Nov 15 2019, 06:50
nakihito edited the test plan for this revision. (Show Details)Nov 15 2019, 20:11
nakihito updated this revision to Diff 14157.Nov 15 2019, 20:16

Updated release notes, rebased, and renamed some functions.

nakihito added inline comments.Nov 15 2019, 20:32
src/seeder/bitcoin.cpp
121 ↗(On Diff #14124)

This is the time out for the socket connection.

nakihito planned changes to this revision.Nov 18 2019, 22:49
nakihito retitled this revision from Seeder filters nodes by chainparams to Seeder bans nodes not following the correct chain.Tue, Feb 11, 01:24
nakihito edited the summary of this revision. (Show Details)
nakihito edited the test plan for this revision. (Show Details)
nakihito updated this revision to Diff 16247.Tue, Feb 11, 01:31

Rebased and CheckForCheckpoint() -> RequestBlocksAfterCheckpoint().

nakihito planned changes to this revision.Tue, Feb 11, 01:31