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;
|
programId: PublicKey;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Amount of program data placed in each load Transaction
|
* Amount of program data placed in each load Transaction
|
||||||
*/
|
*/
|
||||||
|
@ -19,6 +19,11 @@ export type TransactionSignature = string;
|
|||||||
*/
|
*/
|
||||||
export type TransactionId = 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
|
* 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);
|
signData.copy(wireTransaction, 8 + signatures.length * 64);
|
||||||
invariant(
|
invariant(
|
||||||
wireTransaction.length < 512,
|
wireTransaction.length <= PACKET_DATA_SIZE,
|
||||||
`${wireTransaction.length}, ${signatures.length}`,
|
`Transaction too large: ${wireTransaction.length} > ${PACKET_DATA_SIZE}`,
|
||||||
);
|
);
|
||||||
return wireTransaction;
|
return wireTransaction;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user