diff options
author | Pieter Wuille <pieter@wuille.net> | 2023-10-03 14:41:55 -0400 |
---|---|---|
committer | Pieter Wuille <pieter@wuille.net> | 2023-10-04 11:04:43 -0400 |
commit | ba2e5bfc67dcffca26af9e231652ada1767cbeb2 (patch) | |
tree | 919c065cf10f09a821fd04e3e14fa6b632916f75 /src/net.h | |
parent | 97f756b12c8d8a9d3b621f296725dd7bf36bc8a9 (diff) |
net: raise V1_PREFIX_LEN from 12 to 16
A "version" message in the V1 protocol starts with a fixed 16 bytes:
* The 4-byte network magic
* The 12-byte zero-padded command "version" plus 5 0x00 bytes
The current code detects incoming V1 connections by just looking at the
first 12 bytes (matching an earlier version of BIP324), but 16 bytes is
more precise. This isn't an observable difference right now, as a 12 byte
prefix ought to be negligible already, but it may become observable with
future extensions to the protocol, so make the code match the
specification.
Diffstat (limited to 'src/net.h')
-rw-r--r-- | src/net.h | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -473,7 +473,7 @@ private: /** The length of the V1 prefix to match bytes initially received by responders with to * determine if their peer is speaking V1 or V2. */ - static constexpr size_t V1_PREFIX_LEN = 12; + static constexpr size_t V1_PREFIX_LEN = 16; // The sender side and receiver side of V2Transport are state machines that are transitioned // through, based on what has been received. The receive state corresponds to the contents of, |