Migrate loader tests to BankClient

This commit is contained in:
Greg Fitzgerald
2019-03-21 08:14:14 -06:00
parent 58f071b7a0
commit d2415613de
7 changed files with 76 additions and 130 deletions

View File

@ -3,7 +3,6 @@ pub mod bpf_loader;
pub mod genesis_block;
pub mod hash;
pub mod loader_instruction;
pub mod loader_transaction;
pub mod native_loader;
pub mod native_program;
pub mod packet;

View File

@ -1,36 +0,0 @@
//! The `loader_transaction` module provides functionality for loading and calling a program
use crate::hash::Hash;
use crate::loader_instruction::LoaderInstruction;
use crate::pubkey::Pubkey;
use crate::signature::{Keypair, KeypairUtil};
use crate::transaction::Transaction;
pub struct LoaderTransaction {}
impl LoaderTransaction {
pub fn new_write(
from_keypair: &Keypair,
loader: &Pubkey,
offset: u32,
bytes: Vec<u8>,
recent_blockhash: Hash,
fee: u64,
) -> Transaction {
let write_instruction =
LoaderInstruction::new_write(&from_keypair.pubkey(), loader, offset, bytes);
let instructions = vec![write_instruction];
Transaction::new_signed_instructions(&[from_keypair], instructions, recent_blockhash, fee)
}
pub fn new_finalize(
from_keypair: &Keypair,
loader: &Pubkey,
recent_blockhash: Hash,
fee: u64,
) -> Transaction {
let finalize_instruction = LoaderInstruction::new_finalize(&from_keypair.pubkey(), loader);
let instructions = vec![finalize_instruction];
Transaction::new_signed_instructions(&[from_keypair], instructions, recent_blockhash, fee)
}
}