package main import "golang.org/x/crypto/sha3" // Verify the merkle proof for a given node id func verify(id int64, proof [][]byte) []byte { h := sha3.New256() buf := proof[0] for _, hash := range proof[1:] { h.Reset() if id&1 == 0 { h.Write(hash) h.Write(buf) } else { h.Write(buf) h.Write(hash) } buf = h.Sum(buf[:0]) id = (id - 1) >> 1 } return buf }