From d24d3e420d66d4ef2a3f0cd530bbd6ffa21511a1 Mon Sep 17 00:00:00 2001 From: Aayush Rajasekaran Date: Mon, 19 Oct 2020 14:27:04 -0400 Subject: [PATCH] Fix StateReplay to use provided tipset --- node/impl/full/state.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/node/impl/full/state.go b/node/impl/full/state.go index b2e9c3e51..a6564296b 100644 --- a/node/impl/full/state.go +++ b/node/impl/full/state.go @@ -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) { msgToReplay := mc var ts *types.TipSet + var err error if tsk == types.EmptyTSK { mlkp, err := a.StateSearchMsg(ctx, mc) 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) } } 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)