mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-26 09:42:22 +00:00
cli: fix skip usage in DB dump/restore
It was failing to process any blocks at all when (skip >= count) and in other cases it processed wrong number of blocks.
This commit is contained in:
parent
4d770e3c37
commit
4736dad8f0
1 changed files with 2 additions and 2 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue