Bitcoin Forum

Alternate cryptocurrencies => Altcoin Discussion => Topic started by: hey_connor on March 20, 2019, 07:37:02 AM



Title: dnsseed problems
Post by: hey_connor on March 20, 2019, 07:37:02 AM
I'm creating dnsseed based on https://github.com/sipa/bitcoin-seeder. But I got a problem when adapting the seeder software.
The variable "clientVersion" is compared with REQUIRE_VERSION(which is a protocol version) in the function IsGood,
Code:
if (clientVersion && clientVersion < REQUIRE_VERSION) return false;
while it is compared with 31900(which seems to be a client version v0.3.19) in the function GetBanTime.
Code:
if (clientVersion && clientVersion < 31900) { return 604800; }
I'm confused. What on earth should "clientVersion" be compared with? Client version or protocol version?
This is the output of bitcoin-cli.
Code:
$ bitcoin-cli getnetworkinfo
{
  "version": 170100,
  "subversion": "/Satoshi:0.17.1/",
  "protocolversion": 70015,
  ......
}
Looking forward reply. Thanks!


Title: Re: dnsseed problems
Post by: joe@exor on May 18, 2020, 03:30:15 AM
If you follow along with the commits for the bitcoin-seeder app, you will find that the line in GetBanTime which compares clientVersion to 31900 was added a couple years earlier than the line in IsGood which compares to REQUIRE_VERSION.

Dec 22, 2011: https://github.com/sipa/bitcoin-seeder/commit/8b2c4eca5f25f425f2911896125868fec4ca45d8#diff-fc4dfa6031995a26c16f099dd1e8143bR80 (https://github.com/sipa/bitcoin-seeder/commit/8b2c4eca5f25f425f2911896125868fec4ca45d8#diff-fc4dfa6031995a26c16f099dd1e8143bR80)
Apr 14, 2013: https://github.com/sipa/bitcoin-seeder/commit/d8e20ba4844201c0f2dd83c91d0fd614bc5c6cc8#diff-fc4dfa6031995a26c16f099dd1e8143bR96 (https://github.com/sipa/bitcoin-seeder/commit/d8e20ba4844201c0f2dd83c91d0fd614bc5c6cc8#diff-fc4dfa6031995a26c16f099dd1e8143bR96)

Long story short, it certainly seems like an oversight that the 31900 value was left hardcoded and never updated. In my opinion, both values should be compared against the MIN_PEER_PROTO_VERSION value from version.h.

If you are still confused, feel free to take a look at how I handled this in my generic-seeder clone: https://bitcointalk.org/index.php?topic=5239304.0 (https://bitcointalk.org/index.php?topic=5239304.0)