refactor: add constant for max Transaction size
This commit is contained in:
parent
f120ef21ee
commit
aee383eaec
|
@ -23,7 +23,6 @@ export class Loader {
|
|||
*/
|
||||
programId: PublicKey;
|
||||
|
||||
|
||||
/**
|
||||
* Amount of program data placed in each load Transaction
|
||||
*/
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue