aboutsummaryrefslogtreecommitdiffstats
path: root/main.go
blob: 33b2de2e818ea50e9ebdd61af45051f8f5cc3ba1 (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
35
36
37
38
39
40
41
package main

import (
	"flag"
	"log"
	"os"
	"runtime/pprof"
)

type Prover struct {
	Merkle
}

func NewProver(height int64, fname string, mtype string) *Prover {
	m := NewMerkle(mtype, height, fname)
	return &Prover{m}
}

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()

	p := NewProver(*height, *fname, *mtype)
	p.Build()
	/*
		fmt.Println(root)
		id := p.Size() / 2
		proof := p.Proof(id)
		fmt.Println(verify(id, proof))
	*/
}