aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-04-28 23:13:51 +0800
committerobscuren <geffobscura@gmail.com>2015-04-29 18:51:04 +0800
commit04a09b7e2d09d61a7bedd5eeeeabb57e1be99d83 (patch)
treea2b92f4bc762a317d71d78dac71e5f5ffc80da4d
parent32373e3837c5fc3def8050d6de8be34946a3fd75 (diff)
downloadgo-tangerine-04a09b7e2d09d61a7bedd5eeeeabb57e1be99d83.tar.gz
go-tangerine-04a09b7e2d09d61a7bedd5eeeeabb57e1be99d83.tar.zst
go-tangerine-04a09b7e2d09d61a7bedd5eeeeabb57e1be99d83.zip
core: set min gas price at startup
-rw-r--r--core/chain_manager.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/core/chain_manager.go b/core/chain_manager.go
index fb2af0280..d9ab04a02 100644
--- a/core/chain_manager.go
+++ b/core/chain_manager.go
@@ -92,15 +92,14 @@ type ChainManager struct {
func NewChainManager(blockDb, stateDb common.Database, mux *event.TypeMux) *ChainManager {
bc := &ChainManager{
- blockDb: blockDb,
- stateDb: stateDb,
- genesisBlock: GenesisBlock(stateDb),
- eventMux: mux,
- quit: make(chan struct{}),
- cache: NewBlockCache(blockCacheLimit),
- currentGasLimit: new(big.Int),
+ blockDb: blockDb,
+ stateDb: stateDb,
+ genesisBlock: GenesisBlock(stateDb),
+ eventMux: mux,
+ quit: make(chan struct{}),
+ cache: NewBlockCache(blockCacheLimit),
}
- 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
for _, hash := range badHashes {
@@ -145,7 +144,7 @@ func (bc *ChainManager) SetHead(head *types.Block) {
bc.transState = statedb.Copy()
bc.setTotalDifficulty(head.Td)
bc.insert(head)
- bc.setLastBlock()
+ bc.setLastState()
}
func (self *ChainManager) Td() *big.Int {
@@ -212,7 +211,7 @@ func (self *ChainManager) setTransState(statedb *state.StateDB) {
self.transState = statedb
}
-func (bc *ChainManager) setLastBlock() {
+func (bc *ChainManager) setLastState() {
data, _ := bc.blockDb.Get([]byte("LastBlock"))
if len(data) != 0 {
block := bc.GetBlock(common.BytesToHash(data))
@@ -224,6 +223,7 @@ func (bc *ChainManager) setLastBlock() {
} else {
bc.Reset()
}
+ bc.currentGasLimit = CalcGasLimit(bc.currentBlock)
if glog.V(logger.Info) {
glog.Infof("Last block (#%v) %x TD=%v\n", bc.currentBlock.Number(), bc.currentBlock.Hash(), bc.td)