Skip to content

Commit dd17a24

Browse files
committed
supplycommit: avoid adding empty subtrees as leaves in supply tree
Ensures the tree construction in the supplycommit package matches the method used in tapdb when storing the tree in the database.
1 parent 6f968f2 commit dd17a24

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

universe/supplycommit/transitions.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,10 @@ func (c *CommitTreeCreateState) ProcessEvent(event Event,
300300
"sub-tree root: %w", err)
301301
}
302302

303+
if subTreeRoot.NodeSum() == 0 {
304+
continue
305+
}
306+
303307
rootTreeLeaf := mssmt.NewLeafNode(
304308
lnutils.ByteSlice(subTreeRoot.NodeHash()),
305309
subTreeRoot.NodeSum(),

0 commit comments

Comments
 (0)