core/state: add accessor for block hash to remove extra header hash

This commit is contained in:
Felix Lange 2019-03-25 18:43:38 +01:00
parent a6a9df1437
commit 9a02115342
2 changed files with 7 additions and 1 deletions

View file

@ -221,10 +221,16 @@ func (self *StateDB) GetNonce(addr common.Address) uint64 {
return 0
}
// TxIndex returns the current transaction index set by Prepare.
func (self *StateDB) TxIndex() int {
return self.txIndex
}
// BlockHash returns the current block hash set by Prepare.
func (self *StateDB) BlockHash() common.Hash {
return self.bhash
}
func (self *StateDB) GetCode(addr common.Address) []byte {
stateObject := self.getStateObject(addr)
if stateObject != nil {

View file

@ -121,7 +121,7 @@ func ApplyTransaction(config *params.ChainConfig, bc ChainContext, author *commo
// Set the receipt logs and create a bloom for filtering
receipt.Logs = statedb.GetLogs(tx.Hash())
receipt.Bloom = types.CreateBloom(types.Receipts{receipt})
receipt.BlockHash = header.Hash()
receipt.BlockHash = statedb.BlockHash()
receipt.BlockNumber = header.Number
receipt.TransactionIndex = uint(statedb.TxIndex())