diff --git a/consensus/bor/bor.go b/consensus/bor/bor.go index a8f90dfe66d66c446dcf135124e81dec4148227e..fac5500b76c8fbf71c563bd020604a9fa723b1cf 100644 --- a/consensus/bor/bor.go +++ b/consensus/bor/bor.go @@ -555,7 +555,8 @@ func (c *Bor) verifySeal(chain consensus.ChainReader, header *types.Header, pare return err } 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) @@ -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 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) diff --git a/consensus/bor/bor_test/bor_test.go b/consensus/bor/bor_test/bor_test.go index 1c6c530e82ed423d2b14cc801ad1c57d21ce0f71..98331996f92dbb5e5f9bedefd41726bae59e0eb5 100644 --- a/consensus/bor/bor_test/bor_test.go +++ b/consensus/bor/bor_test/bor_test.go @@ -185,5 +185,5 @@ func TestSignerNotFound(t *testing.T) { _, err := chain.InsertChain([]*types.Block{block}) assert.Equal(t, *err.(*bor.UnauthorizedSignerError), - bor.UnauthorizedSignerError{Number: 1, Signer: addr.Bytes()}) + bor.UnauthorizedSignerError{Number: 0, Signer: addr.Bytes()}) }