header: check block protocol (#5340)

## Description

Check block protocol version in header validate basic. 

I tried searching for where we check the P2P protocol version but was unable to find it. When we check compatibility with a node we check we both have the same block protocol and are on the same network, but we do not check if we are on the same P2P protocol. It makes sense if there is a handshake change because we would not be able to establish a secure connection, but a p2p protocol version bump may be because of a p2p message change, which would go unnoticed until that message is sent over the wire.  Is this purposeful?

Closes: #4790
This commit is contained in:
Marko
2020-09-09 11:13:18 +02:00
committed by GitHub
parent c237e06078
commit 6ab2a19088
9 changed files with 39 additions and 11 deletions

View File

@@ -13,7 +13,9 @@ import (
"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/crypto/tmhash"
tmrand "github.com/tendermint/tendermint/libs/rand"
tmversion "github.com/tendermint/tendermint/proto/tendermint/version"
"github.com/tendermint/tendermint/types"
"github.com/tendermint/tendermint/version"
)
func TestLast_FirstLightBlockHeight(t *testing.T) {
@@ -173,6 +175,7 @@ func randLightBlock(height int64) *types.LightBlock {
return &types.LightBlock{
SignedHeader: &types.SignedHeader{
Header: &types.Header{
Version: tmversion.Consensus{Block: version.BlockProtocol, App: 0},
ChainID: tmrand.Str(12),
Height: height,
Time: time.Now(),