mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-03-30 15:08:33 +00:00
Added a friendly error message when genesis hash is not relevant to database (#1745)
Co-authored-by: Constantine Bitensky <constantinebitensky@gmail.com> Co-authored-by: Svarog <feanorr@gmail.com>
This commit is contained in:
parent
2ae1b7853f
commit
70399dae2a
@ -1,6 +1,8 @@
|
||||
package consensus
|
||||
|
||||
import (
|
||||
"github.com/kaspanet/kaspad/domain/consensus/model"
|
||||
"github.com/pkg/errors"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"sync"
|
||||
@ -418,6 +420,11 @@ func (f *factory) NewConsensus(config *Config, db infrastructuredatabase.Databas
|
||||
}
|
||||
|
||||
if !genesisInfo.Exists {
|
||||
if c.blockStore.Count(model.NewStagingArea()) > 0 {
|
||||
return nil, errors.Errorf(
|
||||
"expected genesis block %s is not found in the non-empty DAG \"%s\": wrong config or appdir?",
|
||||
genesisHash, config.Params.Name)
|
||||
}
|
||||
_, err = c.ValidateAndInsertBlock(config.GenesisBlock)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
Loading…
x
Reference in New Issue
Block a user