Skip to content

Commit

Permalink
Do not attempt to save a nil state (#4758)
Browse files Browse the repository at this point in the history
  • Loading branch information
prestonvanloon committed Feb 5, 2020
1 parent 945edb6 commit c496170
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions beacon-chain/db/kv/state.go
Expand Up @@ -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
Expand Down

0 comments on commit c496170

Please sign in to comment.