Skip to content

Commit

Permalink
fix-not-found-err
Browse files Browse the repository at this point in the history
  • Loading branch information
alrxy committed Sep 27, 2024
1 parent 294919a commit 1b8b005
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions x/symStaking/abci/proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"errors"
abci "github.com/cometbft/cometbft/abci/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"os"
)

type ProposalHandler struct {
Expand Down Expand Up @@ -67,13 +68,19 @@ func (h *ProposalHandler) PreBlocker() sdk.PreBlocker {
return err
}

if blockHash == keeper2.INVALID_BLOCKHASH {
err := h.keeper.CacheBlockHash(ctx, stakingtypes.CachedBlockHash{BlockHash: keeper2.INVALID_BLOCKHASH, Height: req.Height})
return err
}

block, err := h.keeper.GetBlockByHash(ctx, blockHash)
if err != nil {
return err
h.logger.Error("PreBlocker error get block by hash error", "err", err)
os.Exit(0) // panic recovers
}

if block.Time() < h.prevBlockTime || int64(block.Time()) >= ctx.HeaderInfo().Time.Unix() || block.Time() < h.keeper.GetMinBlockTimestamp(ctx) {
err := h.keeper.CacheBlockHash(ctx, stakingtypes.CachedBlockHash{BlockHash: blockHash, Height: req.Height})
err := h.keeper.CacheBlockHash(ctx, stakingtypes.CachedBlockHash{BlockHash: keeper2.INVALID_BLOCKHASH, Height: req.Height})
return err
}

Expand Down

0 comments on commit 1b8b005

Please sign in to comment.