trie/bintrie: guard LeafProof against single-stem trees

This commit is contained in:
CPerezz 2026-04-15 22:52:35 +02:00
parent 9769a68c84
commit 7351d8d1c1
No known key found for this signature in database
GPG key ID: 62045F34B97177DD

View file

@ -246,6 +246,12 @@ func (it *binaryNodeIterator) LeafProof() [][]byte {
proof := make([][]byte, 0, len(it.stack)+StemNodeWidth)
if len(it.stack) < 2 {
proof = append(proof, sn.Stem[:])
proof = append(proof, sn.allValues()...)
return proof
}
for i := range it.stack[:len(it.stack)-2] {
state := it.stack[i]
internalNode := it.store.getInternal(state.Node.Index())