|
|
|
@ -45,7 +45,6 @@ import java.util.Map; |
|
|
|
|
import java.util.Objects; |
|
|
|
|
import java.util.Optional; |
|
|
|
|
import java.util.Set; |
|
|
|
|
import java.util.TreeSet; |
|
|
|
|
import java.util.concurrent.ConcurrentHashMap; |
|
|
|
|
import java.util.function.Function; |
|
|
|
|
|
|
|
|
@ -364,18 +363,19 @@ public abstract class DiffBasedWorldStateUpdateAccumulator<ACCOUNT extends DiffB |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
final TreeSet<Map.Entry<UInt256, UInt256>> entries = |
|
|
|
|
new TreeSet<>(Map.Entry.comparingByKey()); |
|
|
|
|
entries.addAll(updatedAccount.getUpdatedStorage().entrySet()); |
|
|
|
|
|
|
|
|
|
// parallel stream here may cause database corruption
|
|
|
|
|
entries.forEach( |
|
|
|
|
updatedAccount |
|
|
|
|
.getUpdatedStorage() |
|
|
|
|
.entrySet() |
|
|
|
|
.forEach( |
|
|
|
|
storageUpdate -> { |
|
|
|
|
final UInt256 keyUInt = storageUpdate.getKey(); |
|
|
|
|
final StorageSlotKey slotKey = |
|
|
|
|
new StorageSlotKey(hashAndSaveSlotPreImage(keyUInt), Optional.of(keyUInt)); |
|
|
|
|
new StorageSlotKey( |
|
|
|
|
hashAndSaveSlotPreImage(keyUInt), Optional.of(keyUInt)); |
|
|
|
|
final UInt256 value = storageUpdate.getValue(); |
|
|
|
|
final DiffBasedValue<UInt256> pendingValue = pendingStorageUpdates.get(slotKey); |
|
|
|
|
final DiffBasedValue<UInt256> pendingValue = |
|
|
|
|
pendingStorageUpdates.get(slotKey); |
|
|
|
|
if (pendingValue == null) { |
|
|
|
|
pendingStorageUpdates.put( |
|
|
|
|
slotKey, |
|
|
|
|