mirror of
https://github.com/arnaucube/arbo.git
synced 2026-01-08 15:01:29 +01:00
Migrate repository to github.com/vocdoni/arbo
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
# arbo [](https://godoc.org/github.com/arnaucube/arbo) [](https://goreportcard.com/report/github.com/arnaucube/arbo) [](https://github.com/arnaucube/arbo/actions?query=workflow%3ATest)
|
# arbo [](https://godoc.org/github.com/vocdoni/arbo) [](https://goreportcard.com/report/github.com/vocdoni/arbo) [](https://github.com/vocdoni/arbo/actions?query=workflow%3ATest)
|
||||||
|
|
||||||
> *arbo*: tree in Esperanto.
|
> *arbo*: tree in Esperanto.
|
||||||
|
|
||||||
@@ -20,14 +20,13 @@ database, err := db.NewBadgerDB(c.TempDir())
|
|||||||
// create new Tree with maxLevels=100 and Blake2b hash function
|
// create new Tree with maxLevels=100 and Blake2b hash function
|
||||||
tree, err := arbo.NewTree(database, 100, arbo.HashFunctionBlake2b)
|
tree, err := arbo.NewTree(database, 100, arbo.HashFunctionBlake2b)
|
||||||
|
|
||||||
|
|
||||||
key := []byte("hello")
|
key := []byte("hello")
|
||||||
value := []byte("world")
|
value := []byte("world")
|
||||||
|
// Add a key & value into the merkle tree
|
||||||
err = tree.Add(key, value)
|
err = tree.Add(key, value)
|
||||||
|
|
||||||
|
|
||||||
// There are cases where multiple key-values (leafs) are going to be added to a
|
// There are cases where multiple key-values (leafs) are going to be added to a
|
||||||
// Tree, for these cases is more effitient to use:
|
// Tree, for these cases is more efficient to use:
|
||||||
invalids, err := tree.AddBatch(keys, values)
|
invalids, err := tree.AddBatch(keys, values)
|
||||||
|
|
||||||
// generate the merkle proof of a leaf by it's key
|
// generate the merkle proof of a leaf by it's key
|
||||||
|
|||||||
2
go.mod
2
go.mod
@@ -1,4 +1,4 @@
|
|||||||
module github.com/arnaucube/arbo
|
module github.com/vocdoni/arbo
|
||||||
|
|
||||||
go 1.16
|
go 1.16
|
||||||
|
|
||||||
|
|||||||
2
tree.go
2
tree.go
@@ -299,7 +299,7 @@ func (t *Tree) down(newKey, currKey []byte, siblings [][]byte,
|
|||||||
" should avoid reaching this point. This panic is temporary" +
|
" should avoid reaching this point. This panic is temporary" +
|
||||||
" for reporting purposes, will be deleted in future versions." +
|
" for reporting purposes, will be deleted in future versions." +
|
||||||
" Please paste this log (including the previous lines) in a" +
|
" Please paste this log (including the previous lines) in a" +
|
||||||
" new issue: https://github.com/arnaucube/arbo/issues/new") // TMP
|
" new issue: https://github.com/vocdoni/arbo/issues/new") // TMP
|
||||||
case PrefixValueLeaf: // leaf
|
case PrefixValueLeaf: // leaf
|
||||||
if !bytes.Equal(currValue, emptyValue) {
|
if !bytes.Equal(currValue, emptyValue) {
|
||||||
if getLeaf {
|
if getLeaf {
|
||||||
|
|||||||
Reference in New Issue
Block a user