diff --git a/core/state/statedb.go b/core/state/statedb.go index a934c8b4e7..81e7c311ea 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -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 { diff --git a/core/state_processor.go b/core/state_processor.go index 6daa139e5f..6f2a45120c 100644 --- a/core/state_processor.go +++ b/core/state_processor.go @@ -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())