Skip to content

Commit 2607824

Browse files
PlasmaPowerzzyalbert
authored andcommitted
miner: fix receipt deep copy in worker (ethereum#23835)
1 parent 57b8f47 commit 2607824

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

miner/worker.go

+10-4
Original file line numberDiff line numberDiff line change
@@ -642,17 +642,23 @@ func (w *worker) resultLoop() {
642642
receipts = make([]*types.Receipt, len(task.receipts))
643643
logs []*types.Log
644644
)
645-
for i, receipt := range task.receipts {
645+
for i, taskReceipt := range task.receipts {
646+
receipt := new(types.Receipt)
647+
receipts[i] = receipt
648+
*receipt = *taskReceipt
649+
646650
// add block location fields
647651
receipt.BlockHash = hash
648652
receipt.BlockNumber = block.Number()
649653
receipt.TransactionIndex = uint(i)
650654

651-
receipts[i] = new(types.Receipt)
652-
*receipts[i] = *receipt
653655
// Update the block hash in all logs since it is now available and not when the
654656
// receipt/log of individual transactions were created.
655-
for _, log := range receipt.Logs {
657+
receipt.Logs = make([]*types.Log, len(taskReceipt.Logs))
658+
for i, taskLog := range taskReceipt.Logs {
659+
log := new(types.Log)
660+
receipt.Logs[i] = log
661+
*log = *taskLog
656662
log.BlockHash = hash
657663
}
658664
logs = append(logs, receipt.Logs...)

0 commit comments

Comments
 (0)