Skip to content

Commit

Permalink
fix: handle boundary conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
0xcb9ff9 committed Nov 8, 2023
1 parent e69bdba commit feeac1c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions consensus/drab/hawaii.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ Diff Turn: │ fillTx time │ DelayLeftOver │ never seal b

func (d *Drab) delayForHawaiiFork(snap *Snapshot, header *types.Header) time.Duration {
delay := time.Until(time.Unix(int64(header.Time), 0)) // time until the block is supposed to be mined
// if delay <= 0 we are late, so we should try to sign immediately
if delay <= 0 {
delay = 0
}

if header.Difficulty.Cmp(diffNoTurn) == 0 {
// It's not our turn explicitly to sign, delay it.
// Wait other validators have signed recently, if timeout we can try sign immediately.
Expand Down

0 comments on commit feeac1c

Please sign in to comment.