core/types: add block location fields to receipt (#17662)

Solves #15210 without changing consensus, in a backwards compatible way,
by adding tx inclusion information to the Receipt struct.
This commit is contained in:
Brent
2019-03-27 08:39:25 -04:00
committed by Felix Lange
parent 42e2c586fd
commit 7fb89697fd
8 changed files with 59 additions and 2 deletions

View File

@ -810,6 +810,11 @@ func SetReceiptsData(config *params.ChainConfig, block *types.Block, receipts ty
// The transaction hash can be retrieved from the transaction itself
receipts[j].TxHash = transactions[j].Hash()
// block location fields
receipts[j].BlockHash = block.Hash()
receipts[j].BlockNumber = block.Number()
receipts[j].TransactionIndex = uint(j)
// The contract address can be derived from the transaction itself
if transactions[j].To() == nil {
// Deriving the signer is expensive, only do if it's actually needed