Unexplicable range error
See original GitHub issueI’m trying to implement this in a project but lately one of the passing tests which was using that library keeps on failing due to:
RangeError: Maximum call stack size exceeded at MerkleTree.createHashes (node_modules/merkletreejs/index.js:41:15) at MerkleTree.createHashes (node_modules/merkletreejs/index.js:87:10) at MerkleTree.createHashes (node_modules/merkletreejs/index.js:87:10) at MerkleTree.createHashes (node_modules/merkletreejs/index.js:87:10) at MerkleTree.createHashes (node_modules/merkletreejs/index.js:87:10) at MerkleTree.createHashes (node_modules/merkletreejs/index.js:87:10) at MerkleTree.createHashes (node_modules/merkletreejs/index.js:87:10) at MerkleTree.createHashes (node_modules/merkletreejs/index.js:87:10) at MerkleTree.createHashes (node_modules/merkletreejs/index.js:87:10) at MerkleTree.createHashes (node_modules/merkletreejs/index.js:87:10)
Is it meant to act like that with a code like (using Block
from here):
const block = new Block();
const SHA256 = require('crypto-js/sha256');
const BSHA3 = bufferify(require('crypto-js/sha3')); //see #5
const leaves = block.transactions.map(BSHA3);
console.log('leaves=', leaves); //[] as expected
block.merkleTree = new MerkleTree(leaves, SHA256); //Runs into the RangeError shown above
Or am I missing something?
EDIT: this doesn’t happen when the leaves point to a non-empty array but give the error whenever it uses an empty one (even before it got filled later on).
Would it be preferrable to only create and initialise the tree once the data passed to the leaves would already be there (say a bunch of transactions in a block) or was that edge case simply not taken into account?
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Inexplicable Subscript out of range error forWorksheet reference ...
I run across the same error from identical, earlier versions of the program that had worked fine. Also, the problem is the same...
Read more >Attempt to write outside buffer bounds" · Issue #7047 · nodejs ...
I've had multiple users report a RangeError: Attempt to write outside buffer bounds error that originates inside the Buffer constructor. Here's ...
Read more >Inexplicable, simple, 'list index out of range' -- Python
I keep trying to use this for loop. Actually a variety of for loops. I keep getting the error, 'list index out of...
Read more >Inexplicable errors by dynare - General DSGE Modeling
I am getting errors which I have never seen before. Without making any changes , the error description changes everytime i run the...
Read more >Inexplicable Error with a simple Script - Unity Forum
Try creating a public instance variable for PickableObject and see if it's possible to assign it through the inspector. One reason this might...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Berkmann18 ah sorry, you’re right. The leaves weren’t being converted into buffers. Pushed an update to convert the leaves into buffers so you don’t need to ‘bufferify’ the hash algo for the leaves
will take a look…