Commit 04a09b7e authored by obscuren's avatar obscuren

core: set min gas price at startup

parent 32373e38
...@@ -92,15 +92,14 @@ type ChainManager struct { ...@@ -92,15 +92,14 @@ type ChainManager struct {
func NewChainManager(blockDb, stateDb common.Database, mux *event.TypeMux) *ChainManager { func NewChainManager(blockDb, stateDb common.Database, mux *event.TypeMux) *ChainManager {
bc := &ChainManager{ bc := &ChainManager{
blockDb: blockDb, blockDb: blockDb,
stateDb: stateDb, stateDb: stateDb,
genesisBlock: GenesisBlock(stateDb), genesisBlock: GenesisBlock(stateDb),
eventMux: mux, eventMux: mux,
quit: make(chan struct{}), quit: make(chan struct{}),
cache: NewBlockCache(blockCacheLimit), cache: NewBlockCache(blockCacheLimit),
currentGasLimit: new(big.Int),
} }
bc.setLastBlock() bc.setLastState()
// Check the current state of the block hashes and make sure that we do not have any of the bad blocks in our chain // Check the current state of the block hashes and make sure that we do not have any of the bad blocks in our chain
for _, hash := range badHashes { for _, hash := range badHashes {
...@@ -145,7 +144,7 @@ func (bc *ChainManager) SetHead(head *types.Block) { ...@@ -145,7 +144,7 @@ func (bc *ChainManager) SetHead(head *types.Block) {
bc.transState = statedb.Copy() bc.transState = statedb.Copy()
bc.setTotalDifficulty(head.Td) bc.setTotalDifficulty(head.Td)
bc.insert(head) bc.insert(head)
bc.setLastBlock() bc.setLastState()
} }
func (self *ChainManager) Td() *big.Int { func (self *ChainManager) Td() *big.Int {
...@@ -212,7 +211,7 @@ func (self *ChainManager) setTransState(statedb *state.StateDB) { ...@@ -212,7 +211,7 @@ func (self *ChainManager) setTransState(statedb *state.StateDB) {
self.transState = statedb self.transState = statedb
} }
func (bc *ChainManager) setLastBlock() { func (bc *ChainManager) setLastState() {
data, _ := bc.blockDb.Get([]byte("LastBlock")) data, _ := bc.blockDb.Get([]byte("LastBlock"))
if len(data) != 0 { if len(data) != 0 {
block := bc.GetBlock(common.BytesToHash(data)) block := bc.GetBlock(common.BytesToHash(data))
...@@ -224,6 +223,7 @@ func (bc *ChainManager) setLastBlock() { ...@@ -224,6 +223,7 @@ func (bc *ChainManager) setLastBlock() {
} else { } else {
bc.Reset() bc.Reset()
} }
bc.currentGasLimit = CalcGasLimit(bc.currentBlock)
if glog.V(logger.Info) { if glog.V(logger.Info) {
glog.Infof("Last block (#%v) %x TD=%v\n", bc.currentBlock.Number(), bc.currentBlock.Hash(), bc.td) glog.Infof("Last block (#%v) %x TD=%v\n", bc.currentBlock.Number(), bc.currentBlock.Hash(), bc.td)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment