cli/server: fix db restorer math wrt skip

Given `-s 1` with a dump of 6001 blocks it skipped the first one and then
tried to import the next 6001 which failed with EOF because there are only
6000 blocks left.
This commit is contained in:
Roman Khimov 2019-12-27 12:15:47 +03:00
parent b706130175
commit ae003a1578

View file

@ -242,7 +242,7 @@ func restoreDB(ctx *cli.Context) error {
return cli.NewExitError(fmt.Errorf("input file has only %d blocks, can't read %d starting from %d", allBlocks, count, skip), 1) return cli.NewExitError(fmt.Errorf("input file has only %d blocks, can't read %d starting from %d", allBlocks, count, skip), 1)
} }
if count == 0 { if count == 0 {
count = allBlocks count = allBlocks - skip
} }
i := uint32(0) i := uint32(0)
for ; i < skip; i++ { for ; i < skip; i++ {