Skip to content

Commit 185d924

Browse files
committed
fix sorting storage does not change original difflayer
1 parent e93cced commit 185d924

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

core/blockchain.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -521,13 +521,13 @@ func (bc *BlockChain) cacheDiffLayer(diffLayer *types.DiffLayer, diffLayerCh cha
521521
sort.SliceStable(diffLayer.Storages, func(i, j int) bool {
522522
return diffLayer.Storages[i].Account.Hex() < diffLayer.Storages[j].Account.Hex()
523523
})
524-
for _, storage := range diffLayer.Storages {
524+
for index := range diffLayer.Storages {
525525
// Sort keys and vals by key.
526-
sort.SliceStable(storage.Keys, func(i, j int) bool {
527-
return storage.Keys[i] < storage.Keys[j]
526+
sort.SliceStable(diffLayer.Storages[index].Keys, func(i, j int) bool {
527+
return diffLayer.Storages[index].Keys[i] < diffLayer.Storages[index].Keys[j]
528528
})
529-
sort.SliceStable(storage.Vals, func(i, j int) bool {
530-
return storage.Keys[i] < storage.Keys[j]
529+
sort.SliceStable(diffLayer.Storages[index].Vals, func(i, j int) bool {
530+
return diffLayer.Storages[index].Keys[i] < diffLayer.Storages[index].Keys[j]
531531
})
532532
}
533533

0 commit comments

Comments
 (0)