From 6ff042ab4a6a4183e7df959c3652cb6b0596b2d7 Mon Sep 17 00:00:00 2001 From: Karim Taam Date: Tue, 1 Oct 2024 10:10:46 +0200 Subject: [PATCH] fix leaf update Signed-off-by: Karim Taam --- .../besu/ethereum/trie/verkle/visitor/PutVisitor.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/hyperledger/besu/ethereum/trie/verkle/visitor/PutVisitor.java b/src/main/java/org/hyperledger/besu/ethereum/trie/verkle/visitor/PutVisitor.java index c2e4bc2..e8e54e0 100644 --- a/src/main/java/org/hyperledger/besu/ethereum/trie/verkle/visitor/PutVisitor.java +++ b/src/main/java/org/hyperledger/besu/ethereum/trie/verkle/visitor/PutVisitor.java @@ -143,7 +143,9 @@ public Node visit(final LeafNode leafNode, final Bytes path) { LeafNode newNode; oldValue = leafNode.getValue(); if (oldValue != value) { - newNode = new LeafNode<>(leafNode.getLocation(), value, oldValue); + newNode = + new LeafNode<>( + leafNode.getLocation(), value, leafNode.isPersisted() ? oldValue : Optional.empty()); batchProcessor.ifPresent( processor -> processor.addNodeToBatch(newNode.getLocation(), newNode)); newNode.markDirty();