Skip to content

Commit

Permalink
fix sorting storage does not change original difflayer
Browse files Browse the repository at this point in the history
  • Loading branch information
dean65 committed May 5, 2022
1 parent e93cced commit 185d924
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions core/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -521,13 +521,13 @@ func (bc *BlockChain) cacheDiffLayer(diffLayer *types.DiffLayer, diffLayerCh cha
sort.SliceStable(diffLayer.Storages, func(i, j int) bool {
return diffLayer.Storages[i].Account.Hex() < diffLayer.Storages[j].Account.Hex()
})
for _, storage := range diffLayer.Storages {
for index := range diffLayer.Storages {
// Sort keys and vals by key.
sort.SliceStable(storage.Keys, func(i, j int) bool {
return storage.Keys[i] < storage.Keys[j]
sort.SliceStable(diffLayer.Storages[index].Keys, func(i, j int) bool {
return diffLayer.Storages[index].Keys[i] < diffLayer.Storages[index].Keys[j]
})
sort.SliceStable(storage.Vals, func(i, j int) bool {
return storage.Keys[i] < storage.Keys[j]
sort.SliceStable(diffLayer.Storages[index].Vals, func(i, j int) bool {
return diffLayer.Storages[index].Keys[i] < diffLayer.Storages[index].Keys[j]
})
}

Expand Down

0 comments on commit 185d924

Please sign in to comment.