Page MenuHomePhabricator

Add -uaclient config option to set the client name and version of the user agent in the version message.
Needs RevisionPublic

Authored by tobias_ruck on Fri, Jun 4, 02:37.

Details

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

Since BCHD unconditionally disconnects from nodes containing the "Bitcoin ABC" string, we cannot use it to connect to a Bitcoin ABC node, even if connected directly using -connect. This option allows to circumvent that feature.

Test Plan

ninja check-functional

Event Timeline

Owners added a reviewer: Restricted Owners Package.Fri, Jun 4, 02:37
deadalnix requested changes to this revision.Fri, Jun 4, 09:59
deadalnix added a subscriber: deadalnix.

This breaks the -uacomment flag.

This revision now requires changes to proceed.Fri, Jun 4, 09:59

Changed to -uaclient, which sets the client name and version of the user agent, staying compatible with -uacomment

tobias_ruck retitled this revision from Add -useragent config option to explicitly set the User Agent in the version message. to Add -uaclient config option to set the client name and version of the user agent in the version message..Sun, Jun 6, 22:03
tobias_ruck edited the summary of this revision. (Show Details)
deadalnix requested changes to this revision.Mon, Jun 7, 09:50
deadalnix added inline comments.
src/init.cpp
2302 ↗(On Diff #28780)

Why? And if that is a requirement, why not ask for a client name and a version number rather than this?

2319 ↗(On Diff #28780)

here

src/net.cpp
3158 ↗(On Diff #28780)

You are branching twice on the same condition for pretty much the same reason (see here comment).

This is indicative of brittle design. For instance, if you take client name + version, then you can simply use the same function in both cases, but if you do not, then you can still create a default uaclient from CLIENT_NAME and CLIENT_VERSION. Either way, this current way of doing it doesn't make sense.

This revision now requires changes to proceed.Mon, Jun 7, 09:50

Changed FormatSubVersion to FormatUserAgent and solely use FormatSubVersionUserAgent now

Why not have two flags that can be set, -uaclientname, and -uaclientversion ?

Seems like that would be the simplest solution.

deadalnix requested changes to this revision.Tue, Jun 8, 15:29
deadalnix added inline comments.
src/init.cpp
2307

It doesn't looks like this should be enforced.

src/net.cpp
3158

That check happens within gArgs.GetArg already.

This revision now requires changes to proceed.Tue, Jun 8, 15:29