diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/CodeDelegation.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/CodeDelegation.java index ef38a982224..ecf1da973f3 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/CodeDelegation.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/CodeDelegation.java @@ -42,8 +42,8 @@ public class CodeDelegation implements org.hyperledger.besu.datatypes.CodeDelega private final Address address; private final long nonce; private final SECPSignature signature; - private Optional
authorizer = Optional.empty(); - private boolean isAuthorityComputed = false; + private final Supplier> authorizerSupplier = + Suppliers.memoize(this::computeAuthority); /** * An access list entry as defined in EIP-7702 @@ -107,12 +107,7 @@ public SECPSignature signature() { @Override public Optional
authorizer() { - if (!isAuthorityComputed) { - authorizer = computeAuthority(); - isAuthorityComputed = true; - } - - return authorizer; + return authorizerSupplier.get(); } @Override