diff --git a/x/observer/keeper/msg_server_add_block_header.go b/x/observer/keeper/msg_server_add_block_header.go index 35ea50f08e..1f93660063 100644 --- a/x/observer/keeper/msg_server_add_block_header.go +++ b/x/observer/keeper/msg_server_add_block_header.go @@ -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()