From 666a7dda369e9a30715f560c8f72b81735a347fc Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Mon, 6 Jul 2015 20:59:12 +0200 Subject: core, eth, rpc: proper gas used. Closes #1417 Added some additional backward compatibility code for old receipts --- eth/gasprice.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'eth/gasprice.go') diff --git a/eth/gasprice.go b/eth/gasprice.go index 09ef8cded..4aa2ad295 100644 --- a/eth/gasprice.go +++ b/eth/gasprice.go @@ -134,7 +134,9 @@ func (self *GasPriceOracle) lowestPrice(block *types.Block) *big.Int { receipts := self.eth.BlockProcessor().GetBlockReceipts(block.Hash()) if len(receipts) > 0 { - gasUsed = receipts[len(receipts)-1].CumulativeGasUsed + if cgu := receipts[len(receipts)-1].CumulativeGasUsed; cgu != nil { + gasUsed = receipts[len(receipts)-1].CumulativeGasUsed + } } if new(big.Int).Mul(gasUsed, big.NewInt(100)).Cmp(new(big.Int).Mul(block.GasLimit(), -- cgit v1.2.3