Skip to content

Commit

Permalink
fix(manager): removed redundant validation err check (#1177)
Browse files Browse the repository at this point in the history
  • Loading branch information
omritoptix authored Oct 30, 2024
1 parent af08d71 commit 7326b64
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions block/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,9 @@ import (
func (m *Manager) applyBlockWithFraudHandling(block *types.Block, commit *types.Commit, blockMetaData types.BlockMetaData) error {
validateWithFraud := func() error {
if err := m.validateBlockBeforeApply(block, commit); err != nil {
if err != nil {
m.blockCache.Delete(block.Header.Height)
// TODO: can we take an action here such as dropping the peer / reducing their reputation?

return fmt.Errorf("block not valid at height %d, dropping it: err:%w", block.Header.Height, err)
}
m.blockCache.Delete(block.Header.Height)
// TODO: can we take an action here such as dropping the peer / reducing their reputation?
return fmt.Errorf("block not valid at height %d, dropping it: err:%w", block.Header.Height, err)
}

if err := m.applyBlock(block, commit, blockMetaData); err != nil {
Expand Down

0 comments on commit 7326b64

Please sign in to comment.