mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-26 09:42:22 +00:00
cli/server: skip genesis block on restore if it matches ours
Enables more convenient imports without skipping over the block 0.
This commit is contained in:
parent
ae003a1578
commit
1f4b7b366e
1 changed files with 7 additions and 0 deletions
|
@ -259,6 +259,13 @@ func restoreDB(ctx *cli.Context) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return cli.NewExitError(err, 1)
|
return cli.NewExitError(err, 1)
|
||||||
}
|
}
|
||||||
|
if block.Index == 0 && i == 0 && skip == 0 {
|
||||||
|
genesis, err := chain.GetBlock(block.Hash())
|
||||||
|
if err == nil && genesis.Index == 0 {
|
||||||
|
log.Info("skipped genesis block ", block.Hash().StringLE())
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
err = chain.AddBlock(block)
|
err = chain.AddBlock(block)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return cli.NewExitError(fmt.Errorf("failed to add block %d: %s", i, err), 1)
|
return cli.NewExitError(fmt.Errorf("failed to add block %d: %s", i, err), 1)
|
||||||
|
|
Loading…
Reference in a new issue