Add loader_ prefix to LoaderTransaction methods

This commit is contained in:
Greg Fitzgerald 2018-11-06 15:44:54 -07:00
parent 6c10458b5b
commit 43bd28cdfa
3 changed files with 10 additions and 10 deletions

View File

@ -7,7 +7,7 @@ use solana_sdk::pubkey::Pubkey;
use transaction::Transaction; use transaction::Transaction;
pub trait LoaderTransaction { pub trait LoaderTransaction {
fn write( fn loader_write(
from_keypair: &Keypair, from_keypair: &Keypair,
loader: Pubkey, loader: Pubkey,
offset: u32, offset: u32,
@ -16,11 +16,11 @@ pub trait LoaderTransaction {
fee: u64, fee: u64,
) -> Self; ) -> Self;
fn finalize(from_keypair: &Keypair, loader: Pubkey, last_id: Hash, fee: u64) -> Self; fn loader_finalize(from_keypair: &Keypair, loader: Pubkey, last_id: Hash, fee: u64) -> Self;
} }
impl LoaderTransaction for Transaction { impl LoaderTransaction for Transaction {
fn write( fn loader_write(
from_keypair: &Keypair, from_keypair: &Keypair,
loader: Pubkey, loader: Pubkey,
offset: u32, offset: u32,
@ -38,7 +38,7 @@ impl LoaderTransaction for Transaction {
Transaction::new(from_keypair, &[], loader, &instruction, last_id, fee) Transaction::new(from_keypair, &[], loader, &instruction, last_id, fee)
} }
fn finalize(from_keypair: &Keypair, loader: Pubkey, last_id: Hash, fee: u64) -> Self { fn loader_finalize(from_keypair: &Keypair, loader: Pubkey, last_id: Hash, fee: u64) -> Self {
trace!( trace!(
"LoaderTransaction::Finalize() program {:?}", "LoaderTransaction::Finalize() program {:?}",
from_keypair.pubkey(), from_keypair.pubkey(),

View File

@ -422,7 +422,7 @@ pub fn process_command(config: &WalletConfig) -> Result<String, Box<error::Error
let mut offset = 0; let mut offset = 0;
for chunk in program_userdata.chunks(USERDATA_CHUNK_SIZE) { for chunk in program_userdata.chunks(USERDATA_CHUNK_SIZE) {
let tx = Transaction::write( let tx = Transaction::loader_write(
&program, &program,
bpf_loader::id(), bpf_loader::id(),
offset, offset,
@ -440,7 +440,7 @@ pub fn process_command(config: &WalletConfig) -> Result<String, Box<error::Error
} }
let last_id = get_last_id(&config)?; let last_id = get_last_id(&config)?;
let tx = Transaction::finalize(&program, bpf_loader::id(), last_id, 0); let tx = Transaction::loader_finalize(&program, bpf_loader::id(), last_id, 0);
send_and_confirm_tx(&config, &tx).map_err(|_| { send_and_confirm_tx(&config, &tx).map_err(|_| {
WalletError::DynamicProgramError("Program finalize transaction failed".to_string()) WalletError::DynamicProgramError("Program finalize transaction failed".to_string())
})?; })?;

View File

@ -75,7 +75,7 @@ impl Loader {
check_tx_results(&bank, &tx, bank.process_transactions(&vec![tx.clone()])); check_tx_results(&bank, &tx, bank.process_transactions(&vec![tx.clone()]));
let name = String::from(loader_name); let name = String::from(loader_name);
let tx = Transaction::write( let tx = Transaction::loader_write(
&loader, &loader,
native_loader::id(), native_loader::id(),
0, 0,
@ -85,7 +85,7 @@ impl Loader {
); );
check_tx_results(&bank, &tx, bank.process_transactions(&vec![tx.clone()])); check_tx_results(&bank, &tx, bank.process_transactions(&vec![tx.clone()]));
let tx = Transaction::finalize(&loader, native_loader::id(), mint.last_id(), 0); let tx = Transaction::loader_finalize(&loader, native_loader::id(), mint.last_id(), 0);
check_tx_results(&bank, &tx, bank.process_transactions(&vec![tx.clone()])); check_tx_results(&bank, &tx, bank.process_transactions(&vec![tx.clone()]));
let tx = Transaction::system_spawn(&loader, mint.last_id(), 0); let tx = Transaction::system_spawn(&loader, mint.last_id(), 0);
@ -144,7 +144,7 @@ impl Program {
let chunk_size = 256; // Size of chunk just needs to fit into tx let chunk_size = 256; // Size of chunk just needs to fit into tx
let mut offset = 0; let mut offset = 0;
for chunk in userdata.chunks(chunk_size) { for chunk in userdata.chunks(chunk_size) {
let tx = Transaction::write( let tx = Transaction::loader_write(
&program, &program,
loader.loader, loader.loader,
offset, offset,
@ -160,7 +160,7 @@ impl Program {
offset += chunk_size as u32; offset += chunk_size as u32;
} }
let tx = Transaction::finalize(&program, loader.loader, loader.mint.last_id(), 0); let tx = Transaction::loader_finalize(&program, loader.loader, loader.mint.last_id(), 0);
check_tx_results( check_tx_results(
&loader.bank, &loader.bank,
&tx, &tx,