add state replay api and command
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
|
||||
cid "github.com/ipfs/go-cid"
|
||||
"github.com/ipfs/go-hamt-ipld"
|
||||
cbor "github.com/ipfs/go-ipld-cbor"
|
||||
"github.com/libp2p/go-libp2p-core/peer"
|
||||
@@ -194,6 +195,24 @@ func (a *StateAPI) StateCall(ctx context.Context, msg *types.Message, ts *types.
|
||||
return a.StateManager.Call(ctx, msg, ts)
|
||||
}
|
||||
|
||||
func (a *StateAPI) StateReplay(ctx context.Context, ts *types.TipSet, mc cid.Cid) (*api.ReplayResults, error) {
|
||||
m, r, err := a.StateManager.Replay(ctx, ts, mc)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var errstr string
|
||||
if r.ActorErr != nil {
|
||||
errstr = r.ActorErr.Error()
|
||||
}
|
||||
|
||||
return &api.ReplayResults{
|
||||
Msg: m,
|
||||
Receipt: &r.MessageReceipt,
|
||||
Error: errstr,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (a *StateAPI) stateForTs(ts *types.TipSet) (*state.StateTree, error) {
|
||||
if ts == nil {
|
||||
ts = a.Chain.GetHeaviestTipSet()
|
||||
|
||||
Reference in New Issue
Block a user