Skip to content

Commit e06ccdc

Browse files
author
Tural Devrishev
committed
cli: support NEP-32 for db dump
Close #3987. Signed-off-by: Tural Devrishev <tural@nspcc.ru>
1 parent 5e99eb9 commit e06ccdc

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

cli/server/cli_dump_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ func TestDBRestoreDump(t *testing.T) {
9494
"--config-path", badConfigDir, "--out", dumpPath)
9595
})
9696

97-
baseCmd := []string{"neo-go", "db", "dump", "--unittest",
97+
baseCmd := []string{"neo-go", "db", "dump", "--unittest", "--non-incremental",
9898
"--config-path", tmpDir, "--out", dumpPath}
9999

100100
t.Run("invalid start/count", func(t *testing.T) {

cli/server/server.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,12 @@ func NewCommands() []*cli.Command {
9797
Usage: "Dump blocks (starting with the genesis or specified block) to the file",
9898
UsageText: "neo-go db dump [-o file] [-s start] [-c count] [--config-path path] [-p/-m/-t] [--config-file file] [--force-timestamp-logs]",
9999
Action: dumpDB,
100-
Flags: cfgCountOutFlags,
100+
Flags: append([]cli.Flag{
101+
&cli.BoolFlag{
102+
Name: "non-incremental",
103+
Usage: "Force non-incremental dump output",
104+
},
105+
}, cfgCountOutFlags...),
101106
},
102107
{
103108
Name: "dump-bin",
@@ -204,7 +209,7 @@ func dumpDB(ctx *cli.Context) error {
204209
if count == 0 {
205210
count = chainCount - start
206211
}
207-
if start != 0 {
212+
if start != 0 || !ctx.Bool("non-incremental") {
208213
writer.WriteU32LE(start)
209214
}
210215
writer.WriteU32LE(count)

0 commit comments

Comments
 (0)