Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DB: Do not allow attempts to save a nil state #4758

Merged
merged 2 commits into from Feb 5, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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