diff options
Diffstat (limited to 'eth')
-rw-r--r-- | eth/gasprice.go | 12 | ||||
-rw-r--r-- | eth/handler.go | 2 |
2 files changed, 7 insertions, 7 deletions
diff --git a/eth/gasprice.go b/eth/gasprice.go index cd5293691..44202d709 100644 --- a/eth/gasprice.go +++ b/eth/gasprice.go @@ -133,20 +133,20 @@ func (self *GasPriceOracle) lowestPrice(block *types.Block) *big.Int { gasUsed = recepits[len(recepits)-1].CumulativeGasUsed } - if new(big.Int).Mul(gasUsed, big.NewInt(100)).Cmp(new(big.Int).Mul(block.Header().GasLimit, + if new(big.Int).Mul(gasUsed, big.NewInt(100)).Cmp(new(big.Int).Mul(block.GasLimit(), big.NewInt(int64(self.eth.GpoFullBlockRatio)))) < 0 { // block is not full, could have posted a tx with MinGasPrice return self.eth.GpoMinGasPrice } - if len(block.Transactions()) < 1 { + txs := block.Transactions() + if len(txs) == 0 { return self.eth.GpoMinGasPrice } - // block is full, find smallest gasPrice - minPrice := block.Transactions()[0].GasPrice() - for i := 1; i < len(block.Transactions()); i++ { - price := block.Transactions()[i].GasPrice() + minPrice := txs[0].GasPrice() + for i := 1; i < len(txs); i++ { + price := txs[i].GasPrice() if price.Cmp(minPrice) < 0 { minPrice = price } diff --git a/eth/handler.go b/eth/handler.go index ad88e9c59..278a2bec2 100644 --- a/eth/handler.go +++ b/eth/handler.go @@ -93,7 +93,7 @@ func NewProtocolManager(protocolVersion, networkId int, mux *event.TypeMux, txpo manager.downloader = downloader.New(manager.eventMux, manager.chainman.HasBlock, manager.chainman.GetBlock, manager.chainman.InsertChain, manager.removePeer) validator := func(block *types.Block, parent *types.Block) error { - return core.ValidateHeader(pow, block.Header(), parent.Header(), true) + return core.ValidateHeader(pow, block.Header(), parent, true) } heighter := func() uint64 { return manager.chainman.CurrentBlock().NumberU64() |