Skip to content

Commit

Permalink
Merge bitcoin#29347: net: enable v2transport by default
Browse files Browse the repository at this point in the history
0bef104 net: enable v2transport by default (Pieter Wuille)

Pull request description:

  This enables BIP324's v2 transport by default (see bitcoin#27634):
  * Inbound connections will auto-sense whether v1 or v2 is in use.
  * Automatic outbound connections will use v2 if `NODE_P2P_V2` was set in addr gossip, but retry with v1 if met with immediate failure.
  * Manual outbound connections will default to v2, but retry with v1 if met with immediate failure.

  It remains possible to run with `-v2transport=0` to disable all of these, and make all outbound and inbound connections v1. It also remains possible to specify the `v2transport` argument to the `addnode` RPC as `false`, to disable attempting a v2 connection for that particular added node.

ACKs for top commit:
  stratospher:
    ACK 0bef104.
  josibake:
    reACK bitcoin@0bef104
  achow101:
    ACK 0bef104
  naumenkogs:
    ACK 0bef104
  theStack:
    ACK 0bef104
  willcl-ark:
    crACK 0bef104
  BrandonOdiwuor:
    utACK 0bef104
  pablomartin4btc:
    re ACK 0bef104
  kristapsk:
    utACK 0bef104

Tree-SHA512: 3f17a91e318b9304c40c74a7a5b231149f664ae684d13e9739a05be6c05ba9720f3c3c62da6a73ace0ae8ce733f1c8410b211f9fa15694e6a8d28999ab9882d8
  • Loading branch information
achow101 authored and PastaPastaPasta committed Oct 24, 2024
1 parent 3599458 commit 3eba0e6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/net.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ static const bool DEFAULT_FIXEDSEEDS = true;
static const size_t DEFAULT_MAXRECEIVEBUFFER = 5 * 1000;
static const size_t DEFAULT_MAXSENDBUFFER = 1 * 1000;

static constexpr bool DEFAULT_V2_TRANSPORT{false};
static constexpr bool DEFAULT_V2_TRANSPORT{true};

#if defined USE_KQUEUE
#define DEFAULT_SOCKETEVENTS "kqueue"
Expand Down
11 changes: 9 additions & 2 deletions test/functional/test_framework/test_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,15 @@ def __init__(self, i, datadir, extra_args_from_options, *, chain, rpchost, timew
# Default behavior from global -v2transport flag is added to args to persist it over restarts.
# May be overwritten in individual tests, using extra_args.
self.default_to_v2 = v2transport
if self.default_to_v2:
self.args.append("-v2transport=1")
if self.version_is_at_least(260000):
# 26.0 and later support v2transport
if v2transport:
self.args.append("-v2transport=1")
else:
self.args.append("-v2transport=0")
else:
# v2transport requested but not supported for node
assert not v2transport

self.cli = TestNodeCLI(bitcoin_cli, self.datadir)
self.use_cli = use_cli
Expand Down

0 comments on commit 3eba0e6

Please sign in to comment.