Skip to content

Commit

Permalink
fix sync issue (hyperledger#7927)
Browse files Browse the repository at this point in the history
Signed-off-by: Karim Taam <[email protected]>
Signed-off-by: Gary Schulte <[email protected]>
  • Loading branch information
matkt authored Nov 26, 2024
1 parent 0e908d2 commit eb097ff
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ public A getWrappedAccount() {
public void setWrappedAccount(final A account) {
if (this.account == null) {
this.account = account;
storageWasCleared = false;
} else {
throw new IllegalStateException("Already tracking a wrapped account");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
import java.util.Collection;
import java.util.Optional;

import org.apache.tuweni.bytes.Bytes;

/**
* An object that buffers updates made over a particular {@link WorldView}.
*
Expand Down Expand Up @@ -75,29 +73,8 @@ default MutableAccount createAccount(final Address address) {
* #createAccount(Address)} (and thus all his fields will be zero/empty).
*/
default MutableAccount getOrCreate(final Address address) {
MutableAccount account = getAccount(address);
if (account == null) {
account = createAccount(address);
if (parentUpdater().isPresent() && parentUpdater().get().isDeleted(address)) {
account.clearStorage();
account.setCode(Bytes.EMPTY);
}
}
return account;
}

/**
* Check this and parent updaters to see if an address has been deleted since the last persist
*
* @param address address to check
* @return true if any updaters have marked the address as deleted.
*/
default boolean isDeleted(final Address address) {
if (getDeletedAccountAddresses().contains(address)) {
return true;
} else {
return parentUpdater().map(wu -> wu.isDeleted(address)).orElse(false);
}
final MutableAccount account = getAccount(address);
return account == null ? createAccount(address) : account;
}

/**
Expand Down

0 comments on commit eb097ff

Please sign in to comment.