mirror of
https://github.com/vacp2p/linea-besu.git
synced 2026-01-09 15:37:54 -05:00
fix sync issue (#7927)
Signed-off-by: Karim Taam <karim.t2am@gmail.com> Signed-off-by: Gary Schulte <garyschulte@gmail.com>
This commit is contained in:
@@ -128,6 +128,7 @@ public class UpdateTrackingAccount<A extends Account> implements MutableAccount
|
||||
public void setWrappedAccount(final A account) {
|
||||
if (this.account == null) {
|
||||
this.account = account;
|
||||
storageWasCleared = false;
|
||||
} else {
|
||||
throw new IllegalStateException("Already tracking a wrapped account");
|
||||
}
|
||||
|
||||
@@ -24,8 +24,6 @@ import java.util.ArrayList;
|
||||
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}.
|
||||
*
|
||||
@@ -75,29 +73,8 @@ public interface WorldUpdater extends MutableWorldView {
|
||||
* #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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user