Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

interrupting commit experiment #556

Merged
merged 17 commits into from
Mar 20, 2023
Prev Previous commit
Next Next commit
consensus/bor: handle unauthorized signer in consensus.Prepare (#651)
  • Loading branch information
manav2401 authored Feb 16, 2023
commit 9ce8c7de75a1b5021bb6f2b8086e813c8244b22c
7 changes: 7 additions & 0 deletions consensus/bor/bor.go
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,13 @@ func (c *Bor) Prepare(chain consensus.ChainHeaderReader, header *types.Header) e

currentSigner := *c.authorizedSigner.Load()

// Bail out early if we're unauthorized to sign a block. This check also takes
// place before block is signed in `Seal`.
if !snap.ValidatorSet.HasAddress(currentSigner.signer) {
// Check the UnauthorizedSignerError.Error() msg to see why we pass number-1
return &UnauthorizedSignerError{number - 1, currentSigner.signer.Bytes()}
}

// Set the correct difficulty
header.Difficulty = new(big.Int).SetUint64(Difficulty(snap.ValidatorSet, currentSigner.signer))

Expand Down