mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 21:07:18 +00:00
7fd2c08be3
* Wrap fcu error * Wrap fcu error * Wrap error better * More test * Add else * Potuz feedback * Propagate the correct root for fcu * Always return true for invalid Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
26 lines
739 B
Go
26 lines
739 B
Go
package blockchain
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/pkg/errors"
|
|
"github.com/prysmaticlabs/prysm/testing/require"
|
|
)
|
|
|
|
func TestIsInvalidBlock(t *testing.T) {
|
|
require.Equal(t, true, IsInvalidBlock(ErrInvalidPayload)) // Already wrapped.
|
|
err := invalidBlock{error: ErrInvalidPayload}
|
|
require.Equal(t, true, IsInvalidBlock(err))
|
|
|
|
newErr := errors.Wrap(err, "wrap me")
|
|
require.Equal(t, true, IsInvalidBlock(newErr))
|
|
}
|
|
|
|
func TestInvalidBlockRoot(t *testing.T) {
|
|
require.Equal(t, [32]byte{}, InvalidBlockRoot(ErrUndefinedExecutionEngineError))
|
|
require.Equal(t, [32]byte{}, InvalidBlockRoot(ErrInvalidPayload))
|
|
|
|
err := invalidBlock{error: ErrInvalidPayload, root: [32]byte{'a'}}
|
|
require.Equal(t, [32]byte{'a'}, InvalidBlockRoot(err))
|
|
}
|