good morning!!!!

Skip to content
Snippets Groups Projects
Commit 1be0c489 authored by atvanguard's avatar atvanguard
Browse files

dev: provide previous block number to UnauthorizedSignerError

parent c7ea09a0
No related branches found
No related tags found
No related merge requests found
...@@ -555,7 +555,8 @@ func (c *Bor) verifySeal(chain consensus.ChainReader, header *types.Header, pare ...@@ -555,7 +555,8 @@ func (c *Bor) verifySeal(chain consensus.ChainReader, header *types.Header, pare
return err return err
} }
if !snap.ValidatorSet.HasAddress(signer.Bytes()) { if !snap.ValidatorSet.HasAddress(signer.Bytes()) {
return &UnauthorizedSignerError{number, signer.Bytes()} // Check the UnauthorizedSignerError.Error() msg to see why we pass number-1
return &UnauthorizedSignerError{number - 1, signer.Bytes()}
} }
succession, err := snap.GetSignerSuccessionNumber(signer) succession, err := snap.GetSignerSuccessionNumber(signer)
...@@ -741,7 +742,8 @@ func (c *Bor) Seal(chain consensus.ChainReader, block *types.Block, results chan ...@@ -741,7 +742,8 @@ func (c *Bor) Seal(chain consensus.ChainReader, block *types.Block, results chan
// Bail out if we're unauthorized to sign a block // Bail out if we're unauthorized to sign a block
if !snap.ValidatorSet.HasAddress(signer.Bytes()) { if !snap.ValidatorSet.HasAddress(signer.Bytes()) {
return &UnauthorizedSignerError{number, signer.Bytes()} // Check the UnauthorizedSignerError.Error() msg to see why we pass number-1
return &UnauthorizedSignerError{number - 1, signer.Bytes()}
} }
successionNumber, err := snap.GetSignerSuccessionNumber(signer) successionNumber, err := snap.GetSignerSuccessionNumber(signer)
......
...@@ -185,5 +185,5 @@ func TestSignerNotFound(t *testing.T) { ...@@ -185,5 +185,5 @@ func TestSignerNotFound(t *testing.T) {
_, err := chain.InsertChain([]*types.Block{block}) _, err := chain.InsertChain([]*types.Block{block})
assert.Equal(t, assert.Equal(t,
*err.(*bor.UnauthorizedSignerError), *err.(*bor.UnauthorizedSignerError),
bor.UnauthorizedSignerError{Number: 1, Signer: addr.Bytes()}) bor.UnauthorizedSignerError{Number: 0, Signer: addr.Bytes()})
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment