@@ -139,6 +139,7 @@ public class RepositoryImpl implements Repository {
139139 private final HashMap <Key , Value <DelegatedResourceAccountIndex >> delegatedResourceAccountIndexCache = new HashMap <>();
140140 private final HashBasedTable <Key , Key , Value <byte []>> transientStorage = HashBasedTable .create ();
141141 private final HashSet <Key > newContractCache = new HashSet <>();
142+ private final HashSet <Key > selfDestructCache = new HashSet <>();
142143
143144 public static void removeLruCache (byte [] address ) {
144145 }
@@ -572,6 +573,29 @@ public boolean isNewContract(byte[] address) {
572573 }
573574 }
574575
576+ @ Override
577+ public void markSelfDestruct (byte [] address ) {
578+ selfDestructCache .add (Key .create (address ));
579+ }
580+
581+ @ Override
582+ public boolean isSelfDestructed (byte [] address ) {
583+ Key key = Key .create (address );
584+ if (selfDestructCache .contains (key )) {
585+ return true ;
586+ }
587+
588+ if (parent != null ) {
589+ boolean isSelfDestructed = parent .isSelfDestructed (address );
590+ if (isSelfDestructed ) {
591+ selfDestructCache .add (key );
592+ }
593+ return isSelfDestructed ;
594+ } else {
595+ return false ;
596+ }
597+ }
598+
575599 @ Override
576600 public void updateAccount (byte [] address , AccountCapsule accountCapsule ) {
577601 accountCache .put (Key .create (address ),
@@ -780,6 +804,7 @@ public void commit() {
780804 commitDelegatedResourceAccountIndexCache (repository );
781805 commitTransientStorage (repository );
782806 commitNewContractCache (repository );
807+ commitSelfDestructCache (repository );
783808 }
784809
785810 @ Override
@@ -1142,6 +1167,12 @@ public void commitNewContractCache(Repository deposit) {
11421167 }
11431168 }
11441169
1170+ private void commitSelfDestructCache (Repository deposit ) {
1171+ if (deposit != null ) {
1172+ selfDestructCache .forEach (key -> deposit .markSelfDestruct (key .getData ()));
1173+ }
1174+ }
1175+
11451176 /**
11461177 * Get the block id from the number.
11471178 */
0 commit comments