This commit is contained in:
Miguel Mota 2018-10-29 13:58:49 -07:00
parent db3e8dc0ce
commit 02f9f9b80f
4 changed files with 8 additions and 8 deletions

View File

@ -137,8 +137,8 @@ class MerkleTree {
* const proof = tree.getProof(leaves[2], 2)
*/
getProof(leaf, index) {
leaf = bufferify(leaf);
const proof = [];
leaf = bufferify(leaf)
const proof = []
if (typeof index !== 'number') {
index = -1

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "merkletreejs",
"version": "0.0.17",
"version": "0.0.18",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "merkletreejs",
"version": "0.0.17",
"version": "0.0.18",
"description": "Construct Merkle Trees and verify proofs",
"main": "index.js",
"types": "index.d.ts",

View File

@ -249,9 +249,9 @@ test('sha-256 with option.isBitcoinTree', t => {
test('sha3 - hex strings', t => {
t.plan(1)
let leaves = ['a', 'b', 'c'].map(x => sha3(x).toString('hex'));
const tree = new MerkleTree(leaves, SHA256);
const root = '311d2e46f49b15fff8b746b74ad57f2cc9e0d9939fda94387141a2d3fdf187ae';
let leaves = ['a', 'b', 'c'].map(x => sha3(x).toString('hex'))
const tree = new MerkleTree(leaves, SHA256)
const root = '311d2e46f49b15fff8b746b74ad57f2cc9e0d9939fda94387141a2d3fdf187ae'
t.equal(tree.getRoot().toString('hex'), root)
})
@ -298,7 +298,7 @@ test('crypto-js SHA3 leaves SHA256 hash algo', t => {
})
t.equal(verifications.every(Boolean), true)
});
})
test('crypto-js bufferify', t => {
t.plan(1)