Skip to content

Commit

Permalink
Merge pull request #822 from maticnetwork/0xkrishna/pos-348
Browse files Browse the repository at this point in the history
Update retry delay time and calculation
  • Loading branch information
0xKrishna authored May 2, 2022
2 parents 7d806b1 + f94c988 commit 1c3bb09
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions bridge/setu/processor/staking.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
)

const (
defaultDelayDuration time.Duration = 10 * time.Second
defaultDelayDuration time.Duration = 15 * time.Second
)

// StakingProcessor - process staking related events
Expand Down Expand Up @@ -354,8 +354,12 @@ func (sp *StakingProcessor) checkValidNonce(validatorId uint64, txnNonce uint64)
}

if currentNonce+1 != txnNonce {
sp.Logger.Error("Nonce for the given event not in order", "validatorId", validatorId, "currentNonce", currentNonce, "txnNonce", txnNonce)
return false, txnNonce - currentNonce, nil
diff := txnNonce - currentNonce
if diff > 10 {
diff = 10
}
sp.Logger.Error("Nonce for the given event not in order", "validatorId", validatorId, "currentNonce", currentNonce, "txnNonce", txnNonce, "delay", diff*uint64(defaultDelayDuration))
return false, diff, nil
}

stakingTxnCount, err := queryTxCount(sp.cliCtx, validatorId, currentHeight)
Expand Down

0 comments on commit 1c3bb09

Please sign in to comment.