Skip to content
Merged
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
1 change: 0 additions & 1 deletion state/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,6 @@ func (state State) MakeBlock(
proposerAddress, &encryptedRandom, implicitHash,
)

fmt.Printf("------------ HEADER HASH : %+v\n", block.Header.Hash())
return block
}

Expand Down
6 changes: 5 additions & 1 deletion state/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package state

import (
"bytes"
"crypto/sha256"
"encoding/hex"
"errors"
"fmt"
Expand Down Expand Up @@ -125,7 +126,10 @@ func validateBlock(state State, block *types.Block) error {
return fmt.Errorf("failed to get implicit hash: %w", err)
}
if !bytes.Equal(block.Header.ImplicitHash, expectedImplicitHash) {
return fmt.Errorf("implicit_hash mismatch: expected %X, got %X", hex.EncodeToString(expectedImplicitHash), hex.EncodeToString(block.Header.ImplicitHash))
emptySha256 := sha256.Sum256([]byte{})
if !(bytes.Equal(block.Header.ImplicitHash, []byte{}) && bytes.Equal(expectedImplicitHash, emptySha256[:])) {
return fmt.Errorf("implicit_hash mismatch: expected %X, got %X", hex.EncodeToString(expectedImplicitHash), hex.EncodeToString(block.Header.ImplicitHash))
}
}

// Validate block Time
Expand Down
Loading