core: added default genesis block

When a user runs a freshly setup geth w/o a database initialised the
default genesis block is decoded and inserted in to the database.
This commit is contained in:
Jeffrey Wilcke 2015-08-01 17:34:48 +02:00
parent e7f4232b10
commit 7a75da63c6
3 changed files with 40 additions and 2 deletions

View File

@ -98,7 +98,15 @@ func NewChainManager(blockDb, stateDb, extraDb common.Database, pow pow.PoW, mux
bc.genesisBlock = bc.GetBlockByNumber(0)
if bc.genesisBlock == nil {
return nil, ErrNoGenesis
reader, err := NewDefaultGenesisReader()
if err != nil {
return nil, err
}
bc.genesisBlock, err = WriteGenesisBlock(stateDb, blockDb, reader)
if err != nil {
return nil, err
}
glog.V(logger.Info).Infoln("WARNING: Wrote default ethereum genesis block")
}
if err := bc.setLastState(); err != nil {

30
core/default_genesis.go Normal file

File diff suppressed because one or more lines are too long

View File

@ -135,7 +135,7 @@ func (pool *TxPool) resetState() {
func (pool *TxPool) Stop() {
close(pool.quit)
pool.events.Unsubscribe()
glog.V(logger.Info).Infoln("TX Pool stopped")
glog.V(logger.Info).Infoln("Transaction pool stopped")
}
func (pool *TxPool) State() *state.ManagedState {