-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
42 lines (35 loc) · 995 Bytes
/
main.go
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
42
package main
import (
"encoding/hex"
"flag"
"fmt"
"github.com/spacemeshos/go-spacemesh/activation"
"github.com/spacemeshos/go-spacemesh/common/types"
"github.com/spacemeshos/post/shared"
)
var (
postNonce uint
postPow uint64
indicesString string
dir string
)
func parseFlags() {
flag.UintVar(&postNonce, "postNonce", 0, "post proof nonce")
flag.Uint64Var(&postPow, "postPow", 0, "post proof pow")
flag.StringVar(&indicesString, "postIndices", "", "post proof indices")
flag.StringVar(&dir, "dir", "./", "post.bin store dir")
flag.Parse()
}
func main() {
parseFlags()
indices, err := hex.DecodeString(indicesString)
if err != nil {
fmt.Printf("invalid commitmentAtxId: %v", err)
}
fmt.Printf("indices: %v", indices)
post := &shared.Proof{Nonce: uint32(postNonce), Indices: indices, Pow: postPow}
if err := activation.SavePost(dir, (*types.Post)(post)); err != nil {
fmt.Printf("failed to save initial post: %v", err)
}
fmt.Printf("quit.")
}