Skip to content

Commit

Permalink
Fix import usage (#69)
Browse files Browse the repository at this point in the history
Fix import usage in example in README
  • Loading branch information
rahulghangas authored Sep 25, 2022
1 parent f1abf11 commit 6274243
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ The concept was first introduced by [@musalbas] in the LazyLedger [academic pape
package main

import (
"bytes"
"crypto/sha256"
"fmt"

Expand All @@ -46,7 +47,7 @@ func main() {
append(namespace.ID{1}, []byte("leaf_3")...)}
// Init a tree with the namespace size as well as
// the underlying hash function:
tree := New(sha256.New(), NamespaceIDSize(nidSize))
tree := nmt.New(sha256.New(), nmt.NamespaceIDSize(nidSize))
for _, d := range data {
if err := tree.Push(d); err != nil {
panic(fmt.Sprintf("unexpected error: %v", err))
Expand All @@ -55,8 +56,8 @@ func main() {
// compute the root
root := tree.Root()
// the root's min/max namespace is the min and max namespace of all leaves:
minNS := MinNamespace(root, tree.NamespaceSize())
maxNS := MaxNamespace(root, tree.NamespaceSize())
minNS := nmt.MinNamespace(root, tree.NamespaceSize())
maxNS := nmt.MaxNamespace(root, tree.NamespaceSize())
if bytes.Equal(minNS, namespace.ID{0}) {
fmt.Printf("Min namespace: %x\n", minNS)
}
Expand Down

0 comments on commit 6274243

Please sign in to comment.