fix: properly fund BPF payer accounts

This commit is contained in:
Tyera Eulberg 2019-12-11 00:38:20 -07:00 committed by Michael Vines
parent d5cd16bef4
commit cc550dfb08
1 changed files with 8 additions and 2 deletions

View File

@ -32,7 +32,10 @@ test('load BPF C program', async () => {
const fees =
feeCalculator.lamportsPerSignature *
(BpfLoader.getMinNumSignatures(data.length) + NUM_RETRIES);
const from = await newAccountWithLamports(connection, fees);
const balanceNeeded = await connection.getMinimumBalanceForRentExemption(
data.length,
);
const from = await newAccountWithLamports(connection, fees + balanceNeeded);
const programId = await BpfLoader.load(connection, from, data);
const transaction = new Transaction().add({
@ -57,7 +60,10 @@ test('load BPF Rust program', async () => {
const fees =
feeCalculator.lamportsPerSignature *
(BpfLoader.getMinNumSignatures(data.length) + NUM_RETRIES);
const from = await newAccountWithLamports(connection, fees);
const balanceNeeded = await connection.getMinimumBalanceForRentExemption(
data.length,
);
const from = await newAccountWithLamports(connection, fees + balanceNeeded);
const programId = await BpfLoader.load(connection, from, data);
const transaction = new Transaction().add({