1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
package main
import (
"flag"
"log"
"os"
"runtime/pprof"
)
func main() {
height := flag.Int64("height", 0, "number of nodes is 2 ** height - 1")
fname := flag.String("db", "test.db", "filename for the database")
mtype := flag.String("mtype", "bfs", "type of Merkle tree (bfs or post)")
p := flag.Bool("p", false, "parallel build")
prof := flag.String("prof", "prof.prof", "filename for profile information")
flag.Parse()
f, err := os.Create(*prof)
if err != nil {
log.Fatal(err)
}
pprof.StartCPUProfile(f)
defer pprof.StopCPUProfile()
m := NewMerkle(*mtype, *height, *fname)
m.Build(*p)
/*
root := make([]byte, hashSize)
m.Read(root, 0)
fmt.Println(root)
id := m.Size()/2 + 1
proof := m.Proof(id)
fmt.Println(verify(id, proof))
*/
}
|