I noticed that I get an error when using more than 2 caveats:
RangeError: Invalid typed array length: 3355443200
Then I found out that the problem is the _grow function of ByteBuffer that always doubles the buffer in size and therefore grows exponentially, even if just one byte is added to the buffer.
My PR fixes this issue as well as two pre-existing bugs (there was a variable this._capacity in _grow that wasn't defined any more and I had to format test/verify.js to make eslint happy).
I noticed that I get an error when using more than 2 caveats:
RangeError: Invalid typed array length: 3355443200
Then I found out that the problem is the
_grow
function ofByteBuffer
that always doubles the buffer in size and therefore grows exponentially, even if just one byte is added to the buffer.My PR fixes this issue as well as two pre-existing bugs (there was a variable
this._capacity
in_grow
that wasn't defined any more and I had to formattest/verify.js
to make eslint happy).