Skip to content

Commit

Permalink
miner: minor feehistory fixes (ethereum#23178)
Browse files Browse the repository at this point in the history
  • Loading branch information
JukLee0ira committed Aug 15, 2024
1 parent 919845d commit 6e71162
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ type worker struct {
coinbase common.Address
extra []byte

snapshotMu sync.RWMutex // The lock used to protect the block snapshot and state snapshot
snapshotMu sync.RWMutex // The lock used to protect the snapshots below
snapshotBlock *types.Block
snapshotReceipts types.Receipts
snapshotState *state.StateDB
Expand Down Expand Up @@ -475,6 +475,16 @@ func (self *worker) push(work *Work) {
}
}

// copyReceipts makes a deep copy of the given receipts.
func copyReceipts(receipts []*types.Receipt) []*types.Receipt {
result := make([]*types.Receipt, len(receipts))
for i, l := range receipts {
cpy := *l
result[i] = &cpy
}
return result
}

// makeCurrent creates a new environment for the current cycle.
func (self *worker) makeCurrent(parent *types.Block, header *types.Header) error {
// Retrieve the parent state to execute on top and start a prefetcher for
Expand Down Expand Up @@ -534,7 +544,7 @@ func (w *worker) updateSnapshot() {
nil,
w.current.receipts,
)
w.snapshotReceipts = w.current.receipts
w.snapshotReceipts = copyReceipts(w.current.receipts)
w.snapshotState = w.current.state.Copy()
}

Expand Down

0 comments on commit 6e71162

Please sign in to comment.