From 2116e2b181edea96d72d90b467e1a06af41fa636 Mon Sep 17 00:00:00 2001 From: Justin Starry Date: Tue, 19 May 2020 11:36:15 +0800 Subject: [PATCH] fix: key length check when decoding instructions --- web3.js/src/system-program.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web3.js/src/system-program.js b/web3.js/src/system-program.js index 9fbc2e924b..3ff5c79a28 100644 --- a/web3.js/src/system-program.js +++ b/web3.js/src/system-program.js @@ -471,9 +471,9 @@ export class SystemInstruction { * @private */ static checkKeyLength(keys: Array, expectedLength: number) { - if (keys.length !== expectedLength) { + if (keys.length < expectedLength) { throw new Error( - `invalid instruction; key length mismatch ${keys.length} != ${expectedLength}`, + `invalid instruction; found ${keys.length} keys, expected at least ${expectedLength}`, ); } }