handle getting state for genesis block

This commit is contained in:
whyrusleeping 2019-10-02 12:00:08 -06:00
parent 1ec5c61015
commit 65def6cc58
2 changed files with 6 additions and 0 deletions

View File

@ -59,6 +59,11 @@ func (sm *StateManager) TipSetState(cids []cid.Cid) (cid.Cid, cid.Cid, error) {
return cid.Undef, cid.Undef, err return cid.Undef, cid.Undef, err
} }
if ts.Height() == 0 {
// NB: Genesis block is a weird case here...
return ts.Blocks()[0].ParentStateRoot, ts.Blocks()[0].ParentMessageReceipts, nil
}
st, rec, err := sm.computeTipSetState(ctx, ts.Blocks(), nil) st, rec, err := sm.computeTipSetState(ctx, ts.Blocks(), nil)
if err != nil { if err != nil {
return cid.Undef, cid.Undef, err return cid.Undef, cid.Undef, err

View File

@ -2,6 +2,7 @@ package full
import ( import (
"context" "context"
"go.uber.org/fx" "go.uber.org/fx"
"golang.org/x/xerrors" "golang.org/x/xerrors"