p2p: fix BIP0031_VERSION to use correct protocol version 60001
What changed, and why it matters
A single number in the rust-bitcoin peer-to-peer networking code was corrected: the protocol version that advertises support for the BIP31 ping/pong feature was changed from 60000 to 60001. This is a bug fix that aligns the code with the Bitcoin protocol specification. The wrong value could cause a node to misidentify itself or misjudge peers during version negotiation, but it is not a direct theft-of-funds or remote-code-execution vulnerability.
Treat as a low-severity protocol-compliance bug. Merge the fix and consider adding a regression test or code comment referencing the BIP31 specification and the correct version number. No emergency response is warranted.
Security signals we found
Protocol version constant mismatch against documented BIP31 behavior
Potential for peer capability misnegotiation
No input validation, memory safety, or cryptographic flaw in the diff
Evidence from the diff
The constant BIP0031_VERSION in p2p/src/lib.rs was set to 60000 instead of the correct 60001. BIP31 introduced the pong message and the nonce field in ping. The protocol version bump to 60001 is the historically documented value in the Bitcoin reference implementation. Using 60000 could lead to incorrect protocol-version comparisons: a node compiled with this constant might report support slightly earlier than it actually does, or might treat peers as not supporting BIP31 when they do. The change is a one-line constant correction.
Changed components
rust-bitcoin p2p moduleProtocolVersion constant BIP0031_VERSIONInspect captured patch +1 / −1
diff --git a/p2p/src/lib.rs b/p2p/src/lib.rs
index 16e24050..c3dc2fd5 100644
--- a/p2p/src/lib.rs
+++ b/p2p/src/lib.rs
@@ -87,7 +87,7 @@ impl ProtocolVersion {
/// Support `sendheaders` message and announce new blocks via headers rather than inv
pub const SENDHEADERS_VERSION: ProtocolVersion = ProtocolVersion(70012);
/// Support `pong` message and nonce in `ping` message
- pub const BIP0031_VERSION: ProtocolVersion = ProtocolVersion(60000);
+ pub const BIP0031_VERSION: ProtocolVersion = ProtocolVersion(60001);
/// All connections will be terminated below this version.
pub const MIN_PEER_PROTO_VERSION: ProtocolVersion = ProtocolVersion(31800);
}
Why this scored 27/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.