mirror of
https://github.com/corda/corda.git
synced 2025-02-09 20:31:18 +00:00
fix corruption of old revisioins in PersistentSet
In PersistentSet.remove, we were modifying the child node in place instead of making a copy to update, which would corrupt older revisions. This commit ensures that we always create a copy if necessary.
This commit is contained in:
parent
4034a219d0
commit
f0129665c6
@ -212,9 +212,11 @@ public class PersistentSet <T> implements Iterable <T> {
|
||||
|
||||
Node<T> child;
|
||||
if (dead.left != NullNode) {
|
||||
child = dead.left;
|
||||
child = new Node(dead.left);
|
||||
} else if (dead.right != NullNode) {
|
||||
child = new Node(dead.right);
|
||||
} else {
|
||||
child = dead.right;
|
||||
child = NullNode;
|
||||
}
|
||||
|
||||
if (ancestors == null) {
|
||||
@ -453,6 +455,7 @@ public class PersistentSet <T> implements Iterable <T> {
|
||||
return new Path(false, s.value, p.root, s.next);
|
||||
}
|
||||
}
|
||||
|
||||
private static class Node <T> {
|
||||
public T value;
|
||||
public Node left;
|
||||
|
Loading…
x
Reference in New Issue
Block a user