Skip to content

Commit

Permalink
fix: error handling on x.getEpochSwitchInfo in sendTimeout should ret…
Browse files Browse the repository at this point in the history
…urn error (#444)

Co-authored-by: wjrjerome <wjrjerome@babylonchain.io>
  • Loading branch information
wjrjerome and jrwbabylonlab authored Mar 9, 2024
1 parent 910d415 commit c7cb63d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions consensus/XDPoS/engines/engine_v2/timeout.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ func (x *XDPoS_v2) sendTimeout(chain consensus.ChainReader) error {
epochSwitchInfo, err := x.getEpochSwitchInfo(chain, currentBlockHeader, currentBlockHeader.Hash())
if err != nil {
log.Error("[sendTimeout] Error when trying to get current epoch switch info for a non-epoch block", "currentRound", x.currentRound, "currentBlockNum", currentBlockHeader.Number, "currentBlockHash", currentBlockHeader.Hash(), "epochNum", epochNum)
return err
}
gapNumber = epochSwitchInfo.EpochSwitchBlockInfo.Number.Uint64() - epochSwitchInfo.EpochSwitchBlockInfo.Number.Uint64()%x.config.Epoch - x.config.Gap
log.Debug("[sendTimeout] non-epoch-switch block found its epoch block and calculated the gapNumber", "epochSwitchInfo.EpochSwitchBlockInfo.Number", epochSwitchInfo.EpochSwitchBlockInfo.Number.Uint64(), "gapNumber", gapNumber)
Expand Down

0 comments on commit c7cb63d

Please sign in to comment.