Skip to content

Commit

Permalink
verify proof
Browse files Browse the repository at this point in the history
  • Loading branch information
laser committed Apr 19, 2018
1 parent be47563 commit 0622ce4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ blocks := [][]byte{

tree := NewTree(Sha256DoubleHash, blocks)



proof := &Proof{
parts: []*ProofPart{{
isRight: true,
Expand Down
16 changes: 3 additions & 13 deletions merkletree_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,19 +372,9 @@ func TestDocsValidateProof(t *testing.T) {

tree := NewTree(Sha256DoubleHash, blocks)

proof := &Proof{
parts: []*ProofPart{{
isRight: true,
checksum: tree.checksumFunc(true, []byte("beta")),
}, {
isRight: true,
checksum: tree.checksumFunc(
false,
append(
tree.checksumFunc(true, []byte("kappa")),
tree.checksumFunc(true, []byte("kappa"))...)),
}},
target: tree.checksumFunc(true, []byte("alpha")),
proof, err := tree.CreateProof(tree.checksumFunc(true, []byte("alpha")))
if err != nil {
panic(err)
}

tree.VerifyProof(proof) // true
Expand Down

0 comments on commit 0622ce4

Please sign in to comment.