Fix StateReplay to use provided tipset
This commit is contained in:
parent
0f5aa9ba5c
commit
d24d3e420d
@ -349,6 +349,7 @@ func (a *StateAPI) StateCall(ctx context.Context, msg *types.Message, tsk types.
|
|||||||
func (a *StateAPI) StateReplay(ctx context.Context, tsk types.TipSetKey, mc cid.Cid) (*api.InvocResult, error) {
|
func (a *StateAPI) StateReplay(ctx context.Context, tsk types.TipSetKey, mc cid.Cid) (*api.InvocResult, error) {
|
||||||
msgToReplay := mc
|
msgToReplay := mc
|
||||||
var ts *types.TipSet
|
var ts *types.TipSet
|
||||||
|
var err error
|
||||||
if tsk == types.EmptyTSK {
|
if tsk == types.EmptyTSK {
|
||||||
mlkp, err := a.StateSearchMsg(ctx, mc)
|
mlkp, err := a.StateSearchMsg(ctx, mc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -370,7 +371,10 @@ func (a *StateAPI) StateReplay(ctx context.Context, tsk types.TipSetKey, mc cid.
|
|||||||
return nil, xerrors.Errorf("loading parent tipset %s: %w", mlkp.TipSet, err)
|
return nil, xerrors.Errorf("loading parent tipset %s: %w", mlkp.TipSet, err)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ts = a.Chain.GetHeaviestTipSet()
|
ts, err = a.Chain.LoadTipSet(tsk)
|
||||||
|
if err != nil {
|
||||||
|
return nil, xerrors.Errorf("loading specified tipset %s: %w", tsk, err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m, r, err := a.StateManager.Replay(ctx, ts, msgToReplay)
|
m, r, err := a.StateManager.Replay(ctx, ts, msgToReplay)
|
||||||
|
Loading…
Reference in New Issue
Block a user