-
Notifications
You must be signed in to change notification settings - Fork 396
Expand file tree
/
Copy pathmerkle_tree_test.go
More file actions
40 lines (39 loc) · 985 Bytes
/
merkle_tree_test.go
File metadata and controls
40 lines (39 loc) · 985 Bytes
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
package merkle_tree
//
// import (
// "encoding/hex"
// "fmt"
// "os"
// "testing"
// )
//
// const BatchFilePath = "lib/test_files/merkle_tree_batch.bin"
//
// const RootFilePath = "lib/test_files/merkle_root.bin"
// func TestVerifyMerkleTreeBatch(t *testing.T) {
// batchByteValue, err := os.ReadFile(BatchFilePath)
// if err != nil {
// t.Fatalf("Error reading batch file: %v", err)
// }
//
// rootByteValue, err := os.ReadFile(RootFilePath)
// if err != nil {
// t.Fatalf("Error reading batch file: %v", err)
// }
//
// merkle_root := make([]byte, hex.DecodedLen(len(rootByteValue)))
// _, err = hex.Decode(merkle_root, rootByteValue)
// if err != nil {
// fmt.Println("Error decoding hex string:", err)
// return
// }
//
// var merkleRoot [32]byte
// copy(merkleRoot[:], merkle_root)
//
// verified, err := VerifyMerkleTreeBatch(batchByteValue, merkleRoot)
// if err != nil || !verified {
// t.Errorf("Batch did not verify Merkle Root")
// }
//
// }