lotus/tvx/list_accessed.go

59 lines
1012 B
Go
Raw Normal View History

package main
import (
"context"
"fmt"
"github.com/ipfs/go-cid"
"github.com/urfave/cli/v2"
"github.com/filecoin-project/oni/tvx/state"
)
var listAccessedFlags struct {
cid string
}
var listAccessedCmd = &cli.Command{
Name: "list-accessed",
Description: "extract actors accessed during the execution of a message",
Action: runListAccessed,
Flags: []cli.Flag{
&apiFlag,
&cli.StringFlag{
Name: "cid",
Usage: "message CID",
Required: true,
Destination: &listAccessedFlags.cid,
},
},
}
func runListAccessed(c *cli.Context) error {
ctx := context.Background()
node, err := makeClient(c)
if err != nil {
return err
}
mid, err := cid.Decode(listAccessedFlags.cid)
if err != nil {
return err
}
2020-09-27 11:02:34 +00:00
rtst := state.NewProxyingStores(ctx, node)
sg := state.NewSurgeon(ctx, node, rtst)
actors, err := sg.GetAccessedActors(context.TODO(), node, mid)
if err != nil {
return err
}
for k := range actors {
fmt.Printf("%v\n", k)
}
return nil
}