mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 02:40:45 +00:00
parent
b53fa6c6d9
commit
81ac9cfb7e
4 changed files with 7 additions and 10 deletions
|
|
@ -225,7 +225,7 @@ func SetupGenesisBlock(db ethdb.Database, genesis *Genesis) (*params.ChainConfig
|
||||||
genesis = DefaultGenesisBlock()
|
genesis = DefaultGenesisBlock()
|
||||||
}
|
}
|
||||||
// Ensure the stored genesis matches with the given one.
|
// Ensure the stored genesis matches with the given one.
|
||||||
hash := genesis.ToBlock(nil).Hash()
|
hash := genesis.ToBlock().Hash()
|
||||||
if hash != stored {
|
if hash != stored {
|
||||||
return genesis.Config, hash, &GenesisMismatchError{stored, hash}
|
return genesis.Config, hash, &GenesisMismatchError{stored, hash}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ func TestSetupGenesis(t *testing.T) {
|
||||||
{
|
{
|
||||||
name: "genesis header present but state missing",
|
name: "genesis header present but state missing",
|
||||||
fn: func(db ethdb.Database) (*params.ChainConfig, common.Hash, error) {
|
fn: func(db ethdb.Database) (*params.ChainConfig, common.Hash, error) {
|
||||||
block := DefaultGenesisBlock().ToBlock(nil)
|
block := DefaultGenesisBlock().ToBlock()
|
||||||
rawdb.WriteCanonicalHash(db, block.Hash(), 0)
|
rawdb.WriteCanonicalHash(db, block.Hash(), 0)
|
||||||
rawdb.WriteHeader(db, block.Header())
|
rawdb.WriteHeader(db, block.Header())
|
||||||
return SetupGenesisBlock(db, nil)
|
return SetupGenesisBlock(db, nil)
|
||||||
|
|
@ -132,7 +132,7 @@ func TestSetupGenesis(t *testing.T) {
|
||||||
{
|
{
|
||||||
name: "genesis block without chain config",
|
name: "genesis block without chain config",
|
||||||
fn: func(db ethdb.Database) (*params.ChainConfig, common.Hash, error) {
|
fn: func(db ethdb.Database) (*params.ChainConfig, common.Hash, error) {
|
||||||
block := DefaultGenesisBlock().ToBlock(db)
|
block := DefaultGenesisBlock().ToBlock()
|
||||||
rawdb.WriteBlock(db, block)
|
rawdb.WriteBlock(db, block)
|
||||||
rawdb.WriteCanonicalHash(db, block.Hash(), 0)
|
rawdb.WriteCanonicalHash(db, block.Hash(), 0)
|
||||||
return SetupGenesisBlock(db, nil)
|
return SetupGenesisBlock(db, nil)
|
||||||
|
|
@ -143,10 +143,7 @@ func TestSetupGenesis(t *testing.T) {
|
||||||
{
|
{
|
||||||
name: "missing block number for head header hash",
|
name: "missing block number for head header hash",
|
||||||
fn: func(db ethdb.Database) (*params.ChainConfig, common.Hash, error) {
|
fn: func(db ethdb.Database) (*params.ChainConfig, common.Hash, error) {
|
||||||
block := DefaultGenesisBlock().ToBlock(db)
|
DefaultGenesisBlock().MustCommit(db)
|
||||||
rawdb.WriteBlock(db, block)
|
|
||||||
rawdb.WriteCanonicalHash(db, block.Hash(), 0)
|
|
||||||
rawdb.WriteChainConfig(db, block.Hash(), params.XDCMainnetChainConfig)
|
|
||||||
rawdb.WriteHeadHeaderHash(db, common.HexToHash("0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"))
|
rawdb.WriteHeadHeaderHash(db, common.HexToHash("0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"))
|
||||||
return SetupGenesisBlock(db, nil)
|
return SetupGenesisBlock(db, nil)
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue