Skip to content

Commit

Permalink
Fix miner receipt deep copy
Browse files Browse the repository at this point in the history
  • Loading branch information
PlasmaPower authored and hkalodner committed Oct 30, 2021
1 parent da25eab commit 0fc21df
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -622,17 +622,23 @@ func (w *worker) resultLoop() {
receipts = make([]*types.Receipt, len(task.receipts))
logs []*types.Log
)
for i, receipt := range task.receipts {
for i, taskReceipt := range task.receipts {
receipt := new(types.Receipt)
receipts[i] = receipt
*receipt = *taskReceipt
receipt.Logs = append([]*types.Log(nil), receipt.Logs...)

// add block location fields
receipt.BlockHash = hash
receipt.BlockNumber = block.Number()
receipt.TransactionIndex = uint(i)

receipts[i] = new(types.Receipt)
*receipts[i] = *receipt
// Update the block hash in all logs since it is now available and not when the
// receipt/log of individual transactions were created.
for _, log := range receipt.Logs {
for i, taskLog := range receipt.Logs {
log := new(types.Log)
receipt.Logs[i] = log
*log = *taskLog
log.BlockHash = hash
}
logs = append(logs, receipt.Logs...)
Expand Down

0 comments on commit 0fc21df

Please sign in to comment.