File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -128,7 +128,7 @@ type worker struct {
128
128
coinbase common.Address
129
129
extra []byte
130
130
131
- snapshotMu sync.RWMutex // The lock used to protect the block snapshot and state snapshot
131
+ snapshotMu sync.RWMutex // The lock used to protect the snapshots below
132
132
snapshotBlock * types.Block
133
133
snapshotReceipts types.Receipts
134
134
snapshotState * state.StateDB
@@ -475,6 +475,16 @@ func (self *worker) push(work *Work) {
475
475
}
476
476
}
477
477
478
+ // copyReceipts makes a deep copy of the given receipts.
479
+ func copyReceipts (receipts []* types.Receipt ) []* types.Receipt {
480
+ result := make ([]* types.Receipt , len (receipts ))
481
+ for i , l := range receipts {
482
+ cpy := * l
483
+ result [i ] = & cpy
484
+ }
485
+ return result
486
+ }
487
+
478
488
// makeCurrent creates a new environment for the current cycle.
479
489
func (self * worker ) makeCurrent (parent * types.Block , header * types.Header ) error {
480
490
// Retrieve the parent state to execute on top and start a prefetcher for
@@ -534,7 +544,7 @@ func (w *worker) updateSnapshot() {
534
544
nil ,
535
545
w .current .receipts ,
536
546
)
537
- w .snapshotReceipts = w .current .receipts
547
+ w .snapshotReceipts = copyReceipts ( w .current .receipts )
538
548
w .snapshotState = w .current .state .Copy ()
539
549
}
540
550
You can’t perform that action at this time.
0 commit comments