diff --git a/web3.js/src/loader.js b/web3.js/src/loader.js index b2167434f7..5c93f4388a 100644 --- a/web3.js/src/loader.js +++ b/web3.js/src/loader.js @@ -23,7 +23,6 @@ export class Loader { */ programId: PublicKey; - /** * Amount of program data placed in each load Transaction */ diff --git a/web3.js/src/transaction.js b/web3.js/src/transaction.js index 00916f940b..f5828e8d73 100644 --- a/web3.js/src/transaction.js +++ b/web3.js/src/transaction.js @@ -19,6 +19,11 @@ export type TransactionSignature = string; */ export type TransactionId = string; +/** + * Maximum over-the-wire size of a Transaction + */ +export const PACKET_DATA_SIZE = 512; + /** * List of TransactionInstruction object fields that may be initialized at construction * @@ -290,8 +295,8 @@ export class Transaction { }); signData.copy(wireTransaction, 8 + signatures.length * 64); invariant( - wireTransaction.length < 512, - `${wireTransaction.length}, ${signatures.length}`, + wireTransaction.length <= PACKET_DATA_SIZE, + `Transaction too large: ${wireTransaction.length} > ${PACKET_DATA_SIZE}`, ); return wireTransaction; }