Improve error log for when database network conflicts with runtime network (#7945)

Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com>
This commit is contained in:
dv8silencer 2020-11-24 23:15:30 -06:00 committed by GitHub
parent 600427bdb0
commit 3ae4b793e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -507,7 +507,10 @@ func (b *BeaconNode) registerPOWChainService() error {
}
}
if len(knownContract) > 0 && !bytes.Equal(cfg.DepositContract.Bytes(), knownContract) {
return fmt.Errorf("database contract is %#x but tried to run with %#x", knownContract, cfg.DepositContract.Bytes())
return fmt.Errorf("database contract is %#x but tried to run with %#x. This likely means "+
"you are trying to run on a different network than what the database contains. You can run once with "+
"'--clear-db' to wipe the old database or use an alternative data directory with '--datadir'",
knownContract, cfg.DepositContract.Bytes())
}
log.Infof("Deposit contract: %#x", cfg.DepositContract.Bytes())