Skip to content

Commit

Permalink
force-v1-protocol-version-for-outbound-connections
Browse files Browse the repository at this point in the history
  • Loading branch information
tholonious authored and lazynina committed Jun 13, 2024
1 parent 2652702 commit 93f40c7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Binary file added .DS_Store
Binary file not shown.
4 changes: 2 additions & 2 deletions lib/remote_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ func (rn *RemoteNode) HandleVersionMessage(verMsg *MsgDeSoVersion, responseNonce
}

// Verify that the peer's version matches our minimal supported version.
if verMsg.Version < rn.params.MinProtocolVersion {
if verMsg.Version < rn.params.MinProtocolVersion && verMsg.Version != 1 {
return fmt.Errorf("RemoteNode.HandleVersionMessage: Requesting disconnect for id: (%v) "+
"protocol version too low. Peer version: %v, min version: %v", rn.id, verMsg.Version, rn.params.MinProtocolVersion)
}
Expand All @@ -538,7 +538,7 @@ func (rn *RemoteNode) HandleVersionMessage(verMsg *MsgDeSoVersion, responseNonce
// In order to smoothly transition to the PoS fork, we prevent establishing new outbound connections with
// outdated nodes that run on ProtocolVersion1. This is because ProtocolVersion1 nodes will not be able to
// validate the PoS blocks and will be stuck on the PoW chain, unless they upgrade to ProtocolVersion2.
if rn.params.ProtocolVersion == ProtocolVersion2 && rn.IsOutbound() {
if rn.params.ProtocolVersion == ProtocolVersion2 && rn.IsOutbound() && verMsg.Version != 1 {
return fmt.Errorf("RemoteNode.HandleVersionMessage: Requesting disconnect for id: (%v). Version too low. "+
"Outbound RemoteNodes must use at least ProtocolVersion2, instead received version: %v", rn.id, verMsg.Version)
}
Expand Down

0 comments on commit 93f40c7

Please sign in to comment.