From be08c6e4699b5e63e42d8d0e209468f5b27e0913 Mon Sep 17 00:00:00 2001 From: Upamanyu Sharma Date: Wed, 4 Dec 2024 22:28:25 -0500 Subject: [PATCH] Tweak loop for proof --- merkle/merkle.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/merkle/merkle.go b/merkle/merkle.go index 57d9355..833b2a0 100644 --- a/merkle/merkle.go +++ b/merkle/merkle.go @@ -77,9 +77,11 @@ func (t *Tree) Put(label []byte, mapVal []byte) ([]byte, []byte, bool) { // correct hashes of interior nodes, bubbling up. // +1/-1 offsets for Goosable uint64 loop var. var loopBuf = make([]byte, 0, numChildren*cryptoffi.HashLen+1) - for depth := cryptoffi.HashLen; depth >= 1; depth-- { + var depth = cryptoffi.HashLen + for depth >= 1 { loopBuf = t.ctx.updInteriorHash(loopBuf, interiors[depth-1]) loopBuf = loopBuf[:0] + depth-- } dig := t.ctx.getHash(t.root)