Skip to content

Commit

Permalink
Fix to get BP working.
Browse files Browse the repository at this point in the history
  • Loading branch information
ejMina226 committed Nov 29, 2024
1 parent a21fe8d commit 77441fb
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ export class SyncCachedLinkedMerkleTreeStore
this.nodeStore.setNode(key, level, value);
}

public getLeaf(index: bigint): StoredLeaf | undefined {
return this.leafStore.getLeaf(index) ?? this.parent.getLeaf(index);
public getLeaf(path: bigint): StoredLeaf | undefined {
return this.leafStore.getLeaf(path) ?? this.parent.getLeaf(path);
}

public setLeaf(index: bigint, value: LinkedLeaf) {
Expand All @@ -42,7 +42,10 @@ export class SyncCachedLinkedMerkleTreeStore
// Need to make sure we call the parent as the super will usually be empty
// The tree calls this method.
public getMaximumIndex(): bigint | undefined {
return this.parent.getMaximumIndex();
return (this.leafStore.getMaximumIndex() ?? -1) >
(this.parent.getMaximumIndex() ?? -1)
? this.leafStore.getMaximumIndex()
: this.parent.getMaximumIndex();
}

public getLeafLessOrEqual(path: bigint): StoredLeaf | undefined {
Expand Down

0 comments on commit 77441fb

Please sign in to comment.