Merge pull request #486 from nspcc-dev/dump-restore-skip-fix

cli: fix skip usage in DB dump/restore
This commit is contained in:
Roman Khimov 2019-11-08 17:24:17 +03:00 committed by GitHub
commit 5c8fb1fc8e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -168,7 +168,7 @@ func dumpDB(ctx *cli.Context) error {
count = chainHeight - skip
}
writer.WriteLE(count)
for i := skip + 1; i <= count; i++ {
for i := skip + 1; i <= skip+count; i++ {
bh := chain.GetHeaderHash(int(i))
b, err := chain.GetBlock(bh)
if err != nil {
@ -227,7 +227,7 @@ func restoreDB(ctx *cli.Context) error {
return cli.NewExitError(err, 1)
}
}
for ; i < count; i++ {
for ; i < skip+count; i++ {
b := &core.Block{}
b.DecodeBinary(reader)
if reader.Err != nil {