fix: load programs in larger chunks

This commit is contained in:
Michael Vines 2019-05-28 15:47:14 -07:00
parent 42494713b3
commit 26eef0f057
1 changed files with 7 additions and 2 deletions

View File

@ -5,7 +5,7 @@ import * as BufferLayout from 'buffer-layout';
import {Account} from './account';
import {PublicKey} from './publickey';
import {NUM_TICKS_PER_SECOND} from './timing';
import {Transaction} from './transaction';
import {Transaction, PACKET_DATA_SIZE} from './transaction';
import {sendAndConfirmTransaction} from './util/send-and-confirm-transaction';
import {sleep} from './util/sleep';
import type {Connection} from './connection';
@ -19,7 +19,12 @@ export class Loader {
* Amount of program data placed in each load Transaction
*/
static get chunkSize(): number {
return 229; // Keep program chunks under PACKET_DATA_SIZE
// Keep program chunks under PACKET_DATA_SIZE, leaving enough room for the
// rest of the Transaction fields
//
// TODO: replace 300 with a proper constant for the size of the other
// Transaction fields
return PACKET_DATA_SIZE - 300;
}
/**