Skip to content

Commit 3742e10

Browse files
committed
feat: add version flag for ChainExport cmd
1 parent ca469f8 commit 3742e10

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

api/v0api/v1_wrapper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ func (w *WrapperV1Full) BeaconGetEntry(ctx context.Context, epoch abi.ChainEpoch
214214
}
215215

216216
func (w *WrapperV1Full) ChainExport(ctx context.Context, nroots abi.ChainEpoch, oldmsgskip bool, tsk types.TipSetKey) (<-chan []byte, error) {
217-
return w.FullNode.ChainExport(ctx, nroots, oldmsgskip, tsk, 1)
217+
return w.FullNode.ChainExport(ctx, nroots, oldmsgskip, tsk, 2)
218218
}
219219

220220
var _ FullNode = &WrapperV1Full{}

cli/chain.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,9 +1107,13 @@ var ChainExportCmd = &cli.Command{
11071107
&cli.BoolFlag{
11081108
Name: "skip-old-msgs",
11091109
},
1110+
&cli.StringFlag{
1111+
Name: "version",
1112+
Value: "2",
1113+
},
11101114
},
11111115
Action: func(cctx *cli.Context) error {
1112-
api, closer, err := GetFullNodeAPI(cctx)
1116+
api, closer, err := GetFullNodeAPIV1(cctx)
11131117
if err != nil {
11141118
return err
11151119
}
@@ -1147,7 +1151,12 @@ var ChainExportCmd = &cli.Command{
11471151
return fmt.Errorf("must pass recent stateroots along with skip-old-msgs")
11481152
}
11491153

1150-
stream, err := api.ChainExport(ctx, rsrs, skipold, ts.Key())
1154+
version := cctx.Uint64("version")
1155+
if version != 1 && version != 2 {
1156+
return fmt.Errorf("invalid version %d", version)
1157+
}
1158+
1159+
stream, err := api.ChainExport(ctx, rsrs, skipold, ts.Key(), version)
11511160
if err != nil {
11521161
return err
11531162
}

0 commit comments

Comments
 (0)