From d8eacc36e3f6c2e6ec2242a8cf4a486f9f38c489 Mon Sep 17 00:00:00 2001 From: brewmaster012 <88689859+brewmaster012@users.noreply.github.com> Date: Tue, 7 Nov 2023 12:00:28 -0600 Subject: [PATCH] add comments for readability --- x/observer/keeper/msg_server_add_block_header.go | 5 +++++ 1 file changed, 5 insertions(+) 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()