diff --git a/platform-sdk/swirlds-virtualmap/src/main/java/com/swirlds/virtualmap/internal/merkle/VirtualRootNode.java b/platform-sdk/swirlds-virtualmap/src/main/java/com/swirlds/virtualmap/internal/merkle/VirtualRootNode.java index fa849ab5f441..a3c05787b1a1 100644 --- a/platform-sdk/swirlds-virtualmap/src/main/java/com/swirlds/virtualmap/internal/merkle/VirtualRootNode.java +++ b/platform-sdk/swirlds-virtualmap/src/main/java/com/swirlds/virtualmap/internal/merkle/VirtualRootNode.java @@ -1316,13 +1316,15 @@ public void onNodeHashed(final long path, final Hash hash) { virtualHash = (rootHash != null) ? rootHash : hasher.emptyRootHash(); } + // There are no remaining changes to be made to the cache, so we can seal it. + cache.seal(); + + // Make sure the copy is marked as hashed after the cache is sealed, otherwise the chances + // are an attempt to merge the cache will fail because the cache hasn't been sealed yet setHashPrivate(virtualHash); final long end = System.currentTimeMillis(); statistics.recordHash(end - start); - - // There are no remaining changes to be made to the cache, so we can seal it. - cache.seal(); } /*