mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-25 17:34:36 +00:00
+3
-3
@@ -24,7 +24,7 @@ func ValidateBlock(meta *types.Block, sh types.SignedHeader) error {
|
||||
return err
|
||||
}
|
||||
if !bytes.Equal(meta.Data.Hash(), meta.Header.DataHash) {
|
||||
return errors.New("Data hash doesn't match header")
|
||||
return errors.New("data hash doesn't match header")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -38,11 +38,11 @@ func ValidateHeader(head *types.Header, sh types.SignedHeader) error {
|
||||
}
|
||||
// Make sure they are for the same height (obvious fail).
|
||||
if head.Height != sh.Height {
|
||||
return errors.New("Header heights mismatched")
|
||||
return errors.New("header heights mismatched")
|
||||
}
|
||||
// Check if they are equal by using hashes.
|
||||
if !bytes.Equal(head.Hash(), sh.Hash()) {
|
||||
return errors.New("Headers don't match")
|
||||
return errors.New("headers don't match")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ func TestValidateBlock(t *testing.T) {
|
||||
{
|
||||
block: &types.Block{Header: types.Header{Height: 10}},
|
||||
signedHeader: types.SignedHeader{Header: &types.Header{Height: 11}},
|
||||
wantErr: "Header heights mismatched",
|
||||
wantErr: "header heights mismatched",
|
||||
},
|
||||
|
||||
{
|
||||
@@ -53,7 +53,7 @@ func TestValidateBlock(t *testing.T) {
|
||||
{
|
||||
block: &types.Block{Header: hdrHeight11},
|
||||
signedHeader: types.SignedHeader{Header: &types.Header{Height: 11}},
|
||||
wantErr: "Headers don't match",
|
||||
wantErr: "headers don't match",
|
||||
},
|
||||
|
||||
{
|
||||
@@ -72,7 +72,7 @@ func TestValidateBlock(t *testing.T) {
|
||||
Header: &types.Header{Height: 11},
|
||||
Commit: types.NewCommit(types.BlockID{Hash: []byte("0xDEADBEEF")}, nil),
|
||||
},
|
||||
wantErr: "Data hash doesn't match header",
|
||||
wantErr: "data hash doesn't match header",
|
||||
},
|
||||
{
|
||||
block: &types.Block{
|
||||
@@ -119,7 +119,7 @@ func TestValidateBlockMeta(t *testing.T) {
|
||||
{
|
||||
meta: &types.BlockMeta{Header: types.Header{Height: 10}},
|
||||
signedHeader: types.SignedHeader{Header: &types.Header{Height: 11}},
|
||||
wantErr: "Header heights mismatched",
|
||||
wantErr: "header heights mismatched",
|
||||
},
|
||||
|
||||
{
|
||||
@@ -132,7 +132,7 @@ func TestValidateBlockMeta(t *testing.T) {
|
||||
{
|
||||
meta: &types.BlockMeta{Header: hdrHeight11},
|
||||
signedHeader: types.SignedHeader{Header: &types.Header{Height: 11}},
|
||||
wantErr: "Headers don't match",
|
||||
wantErr: "headers don't match",
|
||||
},
|
||||
|
||||
{
|
||||
@@ -152,7 +152,7 @@ func TestValidateBlockMeta(t *testing.T) {
|
||||
signedHeader: types.SignedHeader{
|
||||
Header: &types.Header{Height: 11, DataHash: deadBeefHash},
|
||||
},
|
||||
wantErr: "Headers don't match",
|
||||
wantErr: "headers don't match",
|
||||
},
|
||||
|
||||
{
|
||||
@@ -171,7 +171,7 @@ func TestValidateBlockMeta(t *testing.T) {
|
||||
},
|
||||
Commit: types.NewCommit(types.BlockID{Hash: []byte("DEADBEEF")}, nil),
|
||||
},
|
||||
wantErr: "Headers don't match",
|
||||
wantErr: "headers don't match",
|
||||
},
|
||||
|
||||
{
|
||||
@@ -190,7 +190,7 @@ func TestValidateBlockMeta(t *testing.T) {
|
||||
},
|
||||
Commit: types.NewCommit(types.BlockID{Hash: []byte("DEADBEEF")}, nil),
|
||||
},
|
||||
wantErr: "Headers don't match",
|
||||
wantErr: "headers don't match",
|
||||
},
|
||||
// End Headers don't match test
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user