Page MenuHomePhabricator

Seeder bans nodes not following the correct chain
AbandonedPublic

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 Passed
Unit
No Test Coverage

Event Timeline

Owners added a reviewer: Restricted Owners Package.Nov 14 2019, 04:39
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

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

114

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

121

What does this do?

This revision now requires changes to proceed.Nov 14 2019, 14:57

Updated release notes, rebased, and renamed some functions.

src/seeder/bitcoin.cpp
121

This is the time out for the socket connection.

nakihito retitled this revision from Seeder filters nodes by chainparams to Seeder bans nodes not following the correct chain.Feb 11 2020, 01:24
nakihito edited the summary of this revision. (Show Details)
nakihito edited the test plan for this revision. (Show Details)

Rebased and CheckForCheckpoint() -> RequestBlocksAfterCheckpoint().