mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 23:29:12 +01:00
Make v2transport default for addnode RPC when enabled
This commit is contained in:
@@ -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)"},
|
||||
},
|
||||
RPCResult{RPCResult::Type::NONE, "", ""},
|
||||
RPCExamples{
|
||||
@@ -332,9 +332,10 @@ static RPCHelpMan addnode()
|
||||
CConnman& connman = EnsureConnman(node);
|
||||
|
||||
const std::string node_arg{request.params[0].get_str()};
|
||||
bool use_v2transport = self.Arg<bool>(2);
|
||||
bool node_v2transport = connman.GetLocalServices() & NODE_P2P_V2;
|
||||
bool use_v2transport = self.MaybeArg<bool>(2).value_or(node_v2transport);
|
||||
|
||||
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)");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user