diff --git a/CHANGELOG.md b/CHANGELOG.md index 43857f46d420..df072a1d9fdc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,7 +28,6 @@ tests are updated to use EC private keys instead of RSA keys. ### Bug Fixes - Mitigation fix for stale bonsai code storage leading to log rolling issues on contract recreates [#4906](https://github.com/hyperledger/besu/pull/4906) -- Ensure latest cached layered worldstate is subscribed to storage, fix problem with RPC calls using 'latest' [#5039](https://github.com/hyperledger/besu/pull/5039) ## 23.1.0-RC1 diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/bonsai/BonsaiInMemoryWorldState.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/bonsai/BonsaiInMemoryWorldState.java index 2c2e07a34a8e..7c0c2e74ec30 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/bonsai/BonsaiInMemoryWorldState.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/bonsai/BonsaiInMemoryWorldState.java @@ -167,12 +167,7 @@ public void persist(final BlockHeader blockHeader) { final Hash newWorldStateRootHash = rootHash(localUpdater); archive .getTrieLogManager() - .saveTrieLog( - archive, - localUpdater, - newWorldStateRootHash, - blockHeader, - (BonsaiPersistedWorldState) this.copy()); + .saveTrieLog(archive, localUpdater, newWorldStateRootHash, blockHeader, this); worldStateRootHash = newWorldStateRootHash; worldStateBlockHash = blockHeader.getBlockHash(); isPersisted = true; diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/bonsai/BonsaiLayeredWorldState.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/bonsai/BonsaiLayeredWorldState.java index e08394003782..7ac14a37e774 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/bonsai/BonsaiLayeredWorldState.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/bonsai/BonsaiLayeredWorldState.java @@ -76,29 +76,9 @@ public Optional getNextWorldView() { } public void setNextWorldView(final Optional nextWorldView) { - maybeUnSubscribe(); this.nextWorldView = nextWorldView; } - private void maybeUnSubscribe() { - nextWorldView - .filter(WorldState.class::isInstance) - .map(WorldState.class::cast) - .ifPresent( - ws -> { - try { - ws.close(); - } catch (final Exception e) { - // no-op - } - }); - } - - @Override - public void close() throws Exception { - maybeUnSubscribe(); - } - public TrieLogLayer getTrieLog() { return trieLog; } diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/sorter/AbstractPendingTransactionsSorter.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/sorter/AbstractPendingTransactionsSorter.java index cea31614f290..1f3c938ea99c 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/sorter/AbstractPendingTransactionsSorter.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/sorter/AbstractPendingTransactionsSorter.java @@ -428,11 +428,7 @@ private TransactionAddedStatus addTransaction( LOG, "Transaction {} not added because nonce too far in the future for sender {}", transaction::toTraceLog, - () -> - maybeSenderAccount - .map(Account::getAddress) - .map(Address::toString) - .orElse("unknown")); + maybeSenderAccount::toString); return NONCE_TOO_FAR_IN_FUTURE_FOR_SENDER; }