Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow v1 peer off feature/proof-of-stake #1359

Draft
wants to merge 2 commits into
base: feature/proof-of-stake
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
6 changes: 3 additions & 3 deletions lib/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -2273,14 +2273,14 @@ func (srv *Server) _handleBlock(pp *Peer, blk *MsgDeSoBlock, isLastBlock bool) {
// If the FastHotStuffConsensus has been initialized, then we pass the block to the new consensus
// which will validate the block, try to apply it, and handle the orphan case by requesting missing
// parents.
glog.V(1).Infof(CLog(Cyan, fmt.Sprintf(
glog.V(0).Infof(CLog(Cyan, fmt.Sprintf(
"Server._handleBlock: Processing block %v with FastHotStuffConsensus with SyncState=%v for peer %v",
blk, srv.blockchain.chainState(), pp,
)))
blockHashesToRequest, err = srv.fastHotStuffConsensus.HandleBlock(pp, blk)
isOrphan = len(blockHashesToRequest) > 0
} else if !verifySignatures {
glog.V(1).Infof(CLog(Cyan, fmt.Sprintf(
glog.V(0).Infof(CLog(Cyan, fmt.Sprintf(
"Server._handleBlock: Processing block %v WITHOUT signature checking because SyncState=%v for peer %v",
blk, srv.blockchain.chainState(), pp,
)))
Expand All @@ -2289,7 +2289,7 @@ func (srv *Server) _handleBlock(pp *Peer, blk *MsgDeSoBlock, isLastBlock bool) {
// TODO: Signature checking slows things down because it acquires the ChainLock.
// The optimal solution is to check signatures in a way that doesn't acquire the
// ChainLock, which is what Bitcoin Core does.
glog.V(1).Infof(CLog(Cyan, fmt.Sprintf(
glog.V(0).Infof(CLog(Cyan, fmt.Sprintf(
"Server._handleBlock: Processing block %v WITH signature checking because SyncState=%v for peer %v",
blk, srv.blockchain.chainState(), pp,
)))
Expand Down
Loading