prysm-pulse/beacon-chain/state/state-native/ssz.go
Preston Van Loon cc643ac4cc
native-state: Simplify MarshalSSZ (#10677)
Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2022-05-11 14:25:11 +00:00

19 lines
356 B
Go

package state_native
import (
ssz "github.com/ferranbt/fastssz"
"github.com/pkg/errors"
)
var errAssertionFailed = errors.New("failed to convert interface to proto state")
func (b *BeaconState) MarshalSSZ() ([]byte, error) {
proto := b.ToProto()
s, ok := proto.(ssz.Marshaler)
if !ok {
return nil, errAssertionFailed
}
return s.MarshalSSZ()
}