Fixed example code inconsistencies

This commit is contained in:
Donlee 2018-07-09 20:57:31 +01:00
parent 77a20031b0
commit 9ecf38a50a
1 changed files with 6 additions and 6 deletions

View File

@ -86,7 +86,7 @@ function sha256(data) {
return crypto.createHash('sha256').update(data).digest()
}
const leaves = ['a', 'b', 'c'].map(x => sha3(x))
const leaves = ['a', 'b', 'c'].map(x => sha256(x))
const tree = new MerkleTree(leaves, sha256)
```
@ -151,8 +151,8 @@ const proof = tree.getProof(leaves[2])
```
**Example**
```js
const leaves = ['a', 'b', 'a'].map(x => sha3(x))
const tree = new MerkleTree(leaves, sha3)
const leaves = ['a', 'b', 'a'].map(x => sha256(x))
const tree = new MerkleTree(leaves, sha256)
const proof = tree.getProof(leaves[2], 2)
```
@ -224,7 +224,7 @@ function sha256(data) {
return crypto.createHash('sha256').update(data).digest()
}
const leaves = ['a', 'b', 'c'].map(x => sha3(x))
const leaves = ['a', 'b', 'c'].map(x => sha256(x))
const tree = new MerkleTree(leaves, sha256)
```
@ -289,8 +289,8 @@ const proof = tree.getProof(leaves[2])
```
**Example**
```js
const leaves = ['a', 'b', 'a'].map(x => sha3(x))
const tree = new MerkleTree(leaves, sha3)
const leaves = ['a', 'b', 'a'].map(x => sha256(x))
const tree = new MerkleTree(leaves, sha256)
const proof = tree.getProof(leaves[2], 2)
```