From 7b5f2b6c144f96849bc343a14bab3a033ef4d4cc Mon Sep 17 00:00:00 2001 From: artemananiev <33361937+artemananiev@users.noreply.github.com> Date: Thu, 30 May 2024 12:58:38 -0700 Subject: [PATCH] fix: 13610: Backport the fix for 13584 to 0.50 (#13611) Signed-off-by: Artem Ananev --- .../virtualmap/internal/merkle/VirtualRootNode.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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(); } /*