Do not attempt to save a nil state (#4758)

This commit is contained in:
Preston Van Loon
2020-02-05 11:52:14 -08:00
committed by GitHub
parent 945edb6c8f
commit c496170c33

View File

@@ -106,6 +106,9 @@ func (k *Store) GenesisState(ctx context.Context) (*state.BeaconState, error) {
func (k *Store) SaveState(ctx context.Context, state *state.BeaconState, blockRoot [32]byte) error {
ctx, span := trace.StartSpan(ctx, "BeaconDB.SaveState")
defer span.End()
if state == nil {
return errors.New("nil state")
}
enc, err := encode(state.InnerStateUnsafe())
if err != nil {
return err