Skip to content

Commit

Permalink
miner: minor feehistory fixes (23178)
Browse files Browse the repository at this point in the history
  • Loading branch information
JukLee0ira committed Aug 14, 2024
1 parent dd97ae2 commit 4e8f9ab
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 @@ -548,7 +558,7 @@ func (w *worker) updateSnapshot() {
uncles,
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 4e8f9ab

Please sign in to comment.