mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-12 15:03:45 +00:00
dev: provide previous block number to UnauthorizedSignerError
This commit is contained in:
parent
c7ea09a019
commit
1be0c4894a
2 changed files with 5 additions and 3 deletions
|
|
@ -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
|
||||||
|
|
||||||
// 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) {
|
||||||
_, 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()})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue