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.
pull/1569/head
Jeffrey Wilcke 9 years ago
parent e7f4232b10
commit 7a75da63c6
  1. 10
      core/chain_manager.go
  2. 30
      core/default_genesis.go
  3. 2
      core/transaction_pool.go

@ -98,7 +98,15 @@ func NewChainManager(blockDb, stateDb, extraDb common.Database, pow pow.PoW, mux
bc.genesisBlock = bc.GetBlockByNumber(0) bc.genesisBlock = bc.GetBlockByNumber(0)
if bc.genesisBlock == nil { 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 { if err := bc.setLastState(); err != nil {

File diff suppressed because one or more lines are too long

@ -135,7 +135,7 @@ func (pool *TxPool) resetState() {
func (pool *TxPool) Stop() { func (pool *TxPool) Stop() {
close(pool.quit) close(pool.quit)
pool.events.Unsubscribe() 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 { func (pool *TxPool) State() *state.ManagedState {

Loading…
Cancel
Save