Care about nullblocks in handleStateForks
This commit is contained in:
parent
d21e24c270
commit
6ce4cf12f7
@ -31,7 +31,7 @@ func withUpdates(updates ...update) interface{} {
|
||||
}
|
||||
}
|
||||
|
||||
return reflect.ValueOf(notFound(vmctx)).Call([]reflect.Value{})
|
||||
return reflect.ValueOf(notFound(vmctx)).Call([]reflect.Value{args[1]})
|
||||
})
|
||||
|
||||
return out.Interface()
|
||||
|
@ -3,15 +3,21 @@ package stmgr
|
||||
import (
|
||||
"context"
|
||||
"github.com/ipfs/go-cid"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
)
|
||||
|
||||
func (sm *StateManager) handleStateForks(ctx context.Context, pstate cid.Cid, height uint64) (cid.Cid, error) {
|
||||
switch height {
|
||||
case build.ForkNoPowerEPSUpdates: // TODO: +1?
|
||||
return sm.forkNoPowerEPS(ctx, pstate)
|
||||
default:
|
||||
func (sm *StateManager) handleStateForks(ctx context.Context, pstate cid.Cid, height, parentH uint64) (_ cid.Cid, err error) {
|
||||
for i := parentH; i < height; i++ {
|
||||
switch i {
|
||||
case build.ForkNoPowerEPSUpdates:
|
||||
pstate, err = sm.forkNoPowerEPS(ctx, pstate)
|
||||
if err != nil {
|
||||
return cid.Undef, xerrors.Errorf("executing state fork in epoch %d: %w", i, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return pstate, nil
|
||||
}
|
||||
}
|
||||
|
@ -119,10 +119,18 @@ func (sm *StateManager) computeTipSetState(ctx context.Context, blks []*types.Bl
|
||||
}
|
||||
}
|
||||
|
||||
pstate, err := sm.handleStateForks(ctx, blks[0].ParentStateRoot, blks[0].Height)
|
||||
pstate := blks[0].ParentStateRoot
|
||||
if len(blks[0].Parents) > 0 { // don't support forks on genesis
|
||||
parent, err := sm.cs.GetBlock(blks[0].Parents[0])
|
||||
if err != nil {
|
||||
return cid.Undef, cid.Undef, xerrors.Errorf("getting parent block: %w", err)
|
||||
}
|
||||
|
||||
pstate, err = sm.handleStateForks(ctx, blks[0].ParentStateRoot, blks[0].Height, parent.Height)
|
||||
if err != nil {
|
||||
return cid.Undef, cid.Undef, xerrors.Errorf("error handling state forks: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
cids := make([]cid.Cid, len(blks))
|
||||
for i, v := range blks {
|
||||
|
Loading…
Reference in New Issue
Block a user