Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpc: Make v2transport default for addnode RPC when enabled #29239

Merged
merged 1 commit into from Jan 16, 2024

Conversation

sipa
Copy link
Member

@sipa sipa commented Jan 11, 2024

Since #29058, several types of manually configured connections will attempt v2 connections when -v2transport is enabled, except for the addnode RPC, as that one has an explicit argument to enable or disable.

Make the default for that RPC match the -v2transport setting so the behavior matches that of other manual connections from a user perspective.

@DrahtBot
Copy link
Contributor

DrahtBot commented Jan 11, 2024

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage

For detailed information about the code coverage, see the test coverage report.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK kristapsk, theStack, achow101
Concept ACK fanquake
Approach ACK jonatack

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

@sipa sipa changed the title Make v2transaction default for addnode RPC when enabled Make v2transport default for addnode RPC when enabled Jan 11, 2024
@sipa sipa force-pushed the 202401_default_addnode_bip324 branch 2 times, most recently from 9e96e32 to f4e0a1a Compare January 11, 2024 21:40
Copy link
Contributor

@theStack theStack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK

Comment on lines 608 to 610
# skip the optional third argument (default false) for
# compatibility with older clients
from_connection.addnode(ip_port, "onetry")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this still needed for tests with previous releases (earlier than v26.0), which only accept two arguments for addnode?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unsure how relevant that is, but I've changed it to drop the 3rd argument whenever it matches the node -v2transport setting (I think).

Copy link
Member

@maflcko maflcko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing rpc: prefix in title?

src/rpc/net.cpp Outdated Show resolved Hide resolved
@kristapsk
Copy link
Contributor

Concept ACK

@fanquake fanquake changed the title Make v2transport default for addnode RPC when enabled rpc: Make v2transport default for addnode RPC when enabled Jan 12, 2024
@sipa sipa force-pushed the 202401_default_addnode_bip324 branch from f4e0a1a to 6a3461d Compare January 12, 2024 14:18
src/rpc/net.cpp Outdated Show resolved Hide resolved
@glozow glozow added this to the 27.0 milestone Jan 12, 2024
@sipa sipa force-pushed the 202401_default_addnode_bip324 branch from 6a3461d to 3ba815b Compare January 12, 2024 14:31
Copy link
Contributor

@kristapsk kristapsk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 3ba815b

Copy link
Contributor

@theStack theStack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code-review ACK 3ba815b

Copy link
Contributor

@jonatack jonatack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approach ACK


if (use_v2transport && !(node.connman->GetLocalServices() & NODE_P2P_V2)) {
if (use_v2transport && !node_v2transport) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Error: v2transport requested but not enabled (see -v2transport)");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test coverage for this conditional logic and error? Haven't looked deeply but didn't see it in #24748 @stratospher.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing test coverage seems unrelated to this pull? (This line and condition is not changed)

@@ -313,7 +313,7 @@ static RPCHelpMan addnode()
{
{"node", RPCArg::Type::STR, RPCArg::Optional::NO, "The address of the peer to connect to"},
{"command", RPCArg::Type::STR, RPCArg::Optional::NO, "'add' to add a node to the list, 'remove' to remove a node from the list, 'onetry' to try a connection to the node once"},
{"v2transport", RPCArg::Type::BOOL, RPCArg::Default{false}, "Attempt to connect using BIP324 v2 transport protocol (ignored for 'remove' command)"},
{"v2transport", RPCArg::Type::BOOL, RPCArg::DefaultHint{"set by -v2transport"}, "Attempt to connect using BIP324 v2 transport protocol (ignored for 'remove' command)"},
Copy link
Contributor

@jonatack jonatack Jan 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps helpful to disambiguate the config option from this addnode option (beyond the - convention)

Suggested change
{"v2transport", RPCArg::Type::BOOL, RPCArg::DefaultHint{"set by -v2transport"}, "Attempt to connect using BIP324 v2 transport protocol (ignored for 'remove' command)"},
{"v2transport", RPCArg::Type::BOOL, RPCArg::DefaultHint{"set by -v2transport configuration option"}, "Attempt to connect using BIP324 v2 transport protocol (ignored for 'remove' command)"},

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fwiw for the v2transport config option help

current

  -v2transport
       Support v2 transport (default: 0)

suggestion

  -v2transport
       Support BIP324 v2 transport (default: 0)

or

  -v2transport
       Support BIP324 v2 transport protocol (default: 0)

@fanquake
Copy link
Member

Concept ACK for 27.0.

@achow101
Copy link
Member

ACK 3ba815b

@achow101 achow101 merged commit 8106b26 into bitcoin:master Jan 16, 2024
14 of 16 checks passed
Retropex pushed a commit to Retropex/bitcoin that referenced this pull request Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants