aboutsummaryrefslogtreecommitdiffstats
path: root/main.go
blob: 3bf3f6b5aabdcb8adf1d25d8dc388cc808748774 (plain)
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
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)")
	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()
	/*
		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))
	*/
}