@@ -296,19 +296,6 @@ public void commit() {
296296 final BonsaiAccount updatedAccount ;
297297 final BonsaiValue <BonsaiAccount > updatedAccountValue =
298298 accountsToUpdate .get (updatedAddress );
299-
300- final Map <StorageSlotKey , BonsaiValue <UInt256 >> pendingStorageUpdates =
301- storageToUpdate .computeIfAbsent (
302- updatedAddress ,
303- k ->
304- new StorageConsumingMap <>(
305- updatedAddress , new ConcurrentHashMap <>(), storagePreloader ));
306-
307- if (tracked .getStorageWasCleared ()) {
308- storageToClear .add (updatedAddress );
309- pendingStorageUpdates .clear ();
310- }
311-
312299 if (tracked .getWrappedAccount () == null ) {
313300 updatedAccount = new BonsaiAccount (this , tracked );
314301 tracked .setWrappedAccount (updatedAccount );
@@ -328,17 +315,6 @@ public void commit() {
328315 }
329316 if (tracked .getStorageWasCleared ()) {
330317 updatedAccount .clearStorage ();
331- wrappedWorldView ()
332- .getAllAccountStorage (updatedAddress , updatedAccount .getStorageRoot ())
333- .forEach (
334- (keyHash , entryValue ) -> {
335- final StorageSlotKey storageSlotKey =
336- new StorageSlotKey (Hash .wrap (keyHash ), Optional .empty ());
337- final UInt256 value = UInt256 .fromBytes (RLP .decodeOne (entryValue ));
338- pendingStorageUpdates .put (
339- storageSlotKey , new BonsaiValue <>(value , null , true ));
340- });
341- updatedAccount .setStorageRoot (Hash .EMPTY_TRIE_HASH );
342318 }
343319 tracked .getUpdatedStorage ().forEach (updatedAccount ::setStorageValue );
344320 }
@@ -367,6 +343,19 @@ public void commit() {
367343 return ;
368344 }
369345
346+ final StorageConsumingMap <StorageSlotKey , BonsaiValue <UInt256 >>
347+ pendingStorageUpdates =
348+ storageToUpdate .computeIfAbsent (
349+ updatedAddress ,
350+ __ ->
351+ new StorageConsumingMap <>(
352+ updatedAddress , new ConcurrentHashMap <>(), storagePreloader ));
353+
354+ if (tracked .getStorageWasCleared ()) {
355+ storageToClear .add (updatedAddress );
356+ pendingStorageUpdates .clear ();
357+ }
358+
370359 final TreeSet <Map .Entry <UInt256 , UInt256 >> entries =
371360 new TreeSet <>(Map .Entry .comparingByKey ());
372361 entries .addAll (updatedAccount .getUpdatedStorage ().entrySet ());
0 commit comments