Skip to content

Commit efe7c76

Browse files
tholoniouslazynina
authored andcommitted
force-v1-protocol-version-for-outbound-connections
1 parent 89d5df3 commit efe7c76

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

.DS_Store

10 KB
Binary file not shown.

lib/remote_node.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ func (rn *RemoteNode) HandleVersionMessage(verMsg *MsgDeSoVersion, responseNonce
512512
}
513513

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

0 commit comments

Comments
 (0)