Skip to content

Commit c113520

Browse files
authored
miner: fix receipt deep copy in worker (ethereum#23835)
1 parent 57c252e commit c113520

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
@@ -632,17 +632,23 @@ func (w *worker) resultLoop() {
632632
receipts = make([]*types.Receipt, len(task.receipts))
633633
logs []*types.Log
634634
)
635-
for i, receipt := range task.receipts {
635+
for i, taskReceipt := range task.receipts {
636+
receipt := new(types.Receipt)
637+
receipts[i] = receipt
638+
*receipt = *taskReceipt
639+
636640
// add block location fields
637641
receipt.BlockHash = hash
638642
receipt.BlockNumber = block.Number()
639643
receipt.TransactionIndex = uint(i)
640644

641-
receipts[i] = new(types.Receipt)
642-
*receipts[i] = *receipt
643645
// Update the block hash in all logs since it is now available and not when the
644646
// receipt/log of individual transactions were created.
645-
for _, log := range receipt.Logs {
647+
receipt.Logs = make([]*types.Log, len(taskReceipt.Logs))
648+
for i, taskLog := range taskReceipt.Logs {
649+
log := new(types.Log)
650+
receipt.Logs[i] = log
651+
*log = *taskLog
646652
log.BlockHash = hash
647653
}
648654
logs = append(logs, receipt.Logs...)

0 commit comments

Comments
 (0)