Skip to content

Commit

Permalink
add comments for readability
Browse files Browse the repository at this point in the history
  • Loading branch information
brewmaster012 committed Nov 7, 2023
1 parent be1b98d commit d8eacc3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions x/observer/keeper/msg_server_add_block_header.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ func (k msgServer) AddBlockHeader(goCtx context.Context, msg *types.MsgAddBlockH
return nil, cosmoserrors.Wrap(types.ErrBlockAlreadyExist, fmt.Sprintf("block hash: %x", msg.BlockHash))
}

// if parent block header is not found, this tx is rejected
// if no BlockHeaderState is found, allow this vote to pass through to create and initialize
// the Earliest/Latest height with this block header (after voting, not here)
// if BlockHeaderState is found, check if the block height is valid
// validate block height as it's not part of the header itself
bhs, found := k.Keeper.GetBlockHeaderState(ctx, msg.ChainId)
if found && bhs.EarliestHeight > 0 && bhs.EarliestHeight < msg.Height {
pHash, err := msg.Header.ParentHash()
Expand Down

0 comments on commit d8eacc3

Please sign in to comment.