From 9cf772092273c98fa35cd9a2f23d635f47eac6aa Mon Sep 17 00:00:00 2001 From: steveluscher Date: Thu, 24 Mar 2022 11:03:57 -0700 Subject: [PATCH] fix: when there is no instruction index, default to the current instruction by supplying u16:MAX --- web3.js/src/ed25519-program.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/web3.js/src/ed25519-program.ts b/web3.js/src/ed25519-program.ts index b990a06ab7..4e201a8319 100644 --- a/web3.js/src/ed25519-program.ts +++ b/web3.js/src/ed25519-program.ts @@ -94,7 +94,11 @@ export class Ed25519Program { const instructionData = Buffer.alloc(messageDataOffset + message.length); - const index = instructionIndex != null ? instructionIndex : 0; + const index = + instructionIndex == null + ? 0xffff // An index of `u16::MAX` makes it default to the current instruction. + : instructionIndex; + ED25519_INSTRUCTION_LAYOUT.encode( { numSignatures,