From: Matt Corallo Date: Thu, 6 Oct 2022 19:16:13 +0000 (+0000) Subject: [TS] Correct encodeUint64Array array view length X-Git-Tag: v0.0.112.0^2~15 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=6b74b1e81161c39c95b6755954252862dd03ab19;p=ldk-java [TS] Correct encodeUint64Array array view length Otherwise the `set` call fails as the array view we've constructed is only 1 element long. --- diff --git a/typescript_strings.py b/typescript_strings.py index 84dd9a15..ee4e7094 100644 --- a/typescript_strings.py +++ b/typescript_strings.py @@ -187,9 +187,9 @@ export function encodeUint32Array (inputArray: Uint32Array|Array): numbe /* @internal */ export function encodeUint64Array (inputArray: BigUint64Array|Array): number { const cArrayPointer = wasm.TS_malloc((inputArray.length + 1) * 8); - const arrayMemoryView = new BigUint64Array(wasm.memory.buffer, cArrayPointer, 1); - arrayMemoryView.set(inputArray, 1); + const arrayMemoryView = new BigUint64Array(wasm.memory.buffer, cArrayPointer, inputArray.length + 1); arrayMemoryView[0] = BigInt(inputArray.length); + arrayMemoryView.set(inputArray, 1); return cArrayPointer; }