Skip to content

Commit

Permalink
server: Update required minimum protocol version.
Browse files Browse the repository at this point in the history
This updates the required minimum protocol version to the maximum
set by dcrwallet 1.8.0.  Outbound connections will require the
current protocol version.
  • Loading branch information
dajohi authored Feb 19, 2024
1 parent eb3de8e commit 20dedca
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -961,11 +961,21 @@ func (sp *serverPeer) OnVersion(_ *peer.Peer, msg *wire.MsgVersion) {
}
}

// Enforce the minimum protocol limit on outbound connections.
if !isInbound && msg.ProtocolVersion < int32(wire.RemoveRejectVersion) {
srvrLog.Debugf("Rejecting outbound peer %s with protocol version %d prior to "+
"the required version %d", sp, msg.ProtocolVersion,
wire.RemoveRejectVersion)
sp.Disconnect()
return
}

// Reject peers that have a protocol version that is too old.
if msg.ProtocolVersion < int32(wire.SendHeadersVersion) {
// This is the maximum protocol version negotiated by dcrwallet 1.8.0.
if msg.ProtocolVersion < int32(wire.InitStateVersion) {
srvrLog.Debugf("Rejecting peer %s with protocol version %d prior to "+
"the required version %d", sp, msg.ProtocolVersion,
wire.SendHeadersVersion)
wire.InitStateVersion)
sp.Disconnect()
return
}
Expand Down

0 comments on commit 20dedca

Please sign in to comment.