Skip to content

Commit e81a895

Browse files
committed
replace sha3 with keccak256 for ethereumjs-util v6
1 parent 3326788 commit e81a895

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

test/helpers/merkleTree.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
const { sha3, bufferToHex } = require('ethereumjs-util');
1+
const { keccak256, bufferToHex } = require('ethereumjs-util');
22

33
class MerkleTree {
44
constructor (elements) {
55
// Filter empty strings and hash elements
6-
this.elements = elements.filter(el => el).map(el => sha3(el));
6+
this.elements = elements.filter(el => el).map(el => keccak256(el));
77

88
// Deduplicate elements
99
this.elements = this.bufDedup(this.elements);
@@ -45,7 +45,7 @@ class MerkleTree {
4545
if (!first) { return second; }
4646
if (!second) { return first; }
4747

48-
return sha3(this.sortAndConcat(first, second));
48+
return keccak256(this.sortAndConcat(first, second));
4949
}
5050

5151
getRoot () {
@@ -97,7 +97,7 @@ class MerkleTree {
9797

9898
// Convert element to 32 byte hash if it is not one already
9999
if (el.length !== 32 || !Buffer.isBuffer(el)) {
100-
hash = sha3(el);
100+
hash = keccak256(el);
101101
} else {
102102
hash = el;
103103
}

0 commit comments

Comments
 (0)