More precise constructor names

This commit is contained in:
Greg Fitzgerald 2019-03-15 10:02:28 -06:00
parent 968022a1b0
commit e091aa87ea
13 changed files with 39 additions and 39 deletions

View File

@ -503,7 +503,7 @@ mod tests {
let instructions = vec![CompiledInstruction::new(0, &system_instruction, vec![0, 1])];
let tx = Transaction::new_with_instructions(
let tx = Transaction::new_with_compiled_instructions(
&keypairs,
&[],
blockhash,

View File

@ -132,7 +132,7 @@ impl Drone {
space: 0,
program_id: system_program::id(),
};
let mut transaction = Transaction::new(
let mut transaction = Transaction::new_signed(
&self.mint_keypair,
&[to],
&system_program::id(),
@ -408,7 +408,7 @@ mod tests {
space: 0,
program_id: system_program::id(),
};
let mut expected_tx = Transaction::new(
let mut expected_tx = Transaction::new_signed(
&keypair,
&[to],
&system_program::id(),

View File

@ -17,7 +17,7 @@ fn test_local_drone() {
space: 0,
program_id: system_program::id(),
};
let mut expected_tx = Transaction::new(
let mut expected_tx = Transaction::new_signed(
&keypair,
&[to],
&system_program::id(),

View File

@ -43,7 +43,7 @@ mod bpf {
// Call user program
let program_id = load_program(&bank, &mint_keypair, &bpf_loader::id(), elf);
let tx = Transaction::new(
let tx = Transaction::new_signed(
&mint_keypair,
&[],
&program_id,
@ -86,7 +86,7 @@ mod bpf {
// Call user program
let program_id = load_program(&bank, &mint_keypair, &loader_id, elf);
let tx = Transaction::new(
let tx = Transaction::new_signed(
&mint_keypair,
&[],
&program_id,
@ -132,7 +132,7 @@ mod bpf {
// Call user program
let program_id = load_program(&bank, &mint_keypair, &loader_id, elf);
let tx = Transaction::new(
let tx = Transaction::new_signed(
&mint_keypair,
&[],
&program_id,

View File

@ -177,7 +177,7 @@ mod test {
let from = Keypair::new();
let contract = Keypair::new();
let data = (1u8, 2u8, 3u8);
let tx = Transaction::new(
let tx = Transaction::new_signed(
&from,
&[contract.pubkey()],
&id(),

View File

@ -14,7 +14,7 @@ fn test_program_native_failure() {
let program_id = load_program(&bank, &mint_keypair, &native_loader::id(), program);
// Call user program
let tx = Transaction::new(
let tx = Transaction::new_signed(
&mint_keypair,
&[],
&program_id,

View File

@ -15,7 +15,7 @@ fn test_program_native_noop() {
let program_id = load_program(&bank, &mint_keypair, &native_loader::id(), program);
// Call user program
let tx = Transaction::new(
let tx = Transaction::new_signed(
&mint_keypair,
&[],
&program_id,

View File

@ -90,7 +90,7 @@ impl StorageTransaction {
entry_height,
signature,
};
Transaction::new(from_keypair, &[], &id(), &program, recent_blockhash, 0)
Transaction::new_signed(from_keypair, &[], &id(), &program, recent_blockhash, 0)
}
pub fn new_advertise_recent_blockhash(
@ -103,7 +103,7 @@ impl StorageTransaction {
hash: storage_hash,
entry_height,
};
Transaction::new(from_keypair, &[], &id(), &program, recent_blockhash, 0)
Transaction::new_signed(from_keypair, &[], &id(), &program, recent_blockhash, 0)
}
pub fn new_proof_validation(
@ -116,7 +116,7 @@ impl StorageTransaction {
entry_height,
proof_mask,
};
Transaction::new(from_keypair, &[], &id(), &program, recent_blockhash, 0)
Transaction::new_signed(from_keypair, &[], &id(), &program, recent_blockhash, 0)
}
pub fn new_reward_claim(
@ -125,6 +125,6 @@ impl StorageTransaction {
entry_height: u64,
) -> Transaction {
let program = StorageProgram::ClaimStorageReward { entry_height };
Transaction::new(from_keypair, &[], &id(), &program, recent_blockhash, 0)
Transaction::new_signed(from_keypair, &[], &id(), &program, recent_blockhash, 0)
}
}

View File

@ -1047,7 +1047,7 @@ mod tests {
let mut error_counters = ErrorCounters::default();
let instructions = vec![CompiledInstruction::new(1, &(), vec![0])];
let tx = Transaction::new_with_instructions::<Keypair>(
let tx = Transaction::new_with_compiled_instructions::<Keypair>(
&[],
&[],
Hash::default(),
@ -1071,7 +1071,7 @@ mod tests {
let keypair = Keypair::new();
let instructions = vec![CompiledInstruction::new(1, &(), vec![0])];
let tx = Transaction::new_with_instructions(
let tx = Transaction::new_with_compiled_instructions(
&[&keypair],
&[],
Hash::default(),
@ -1103,7 +1103,7 @@ mod tests {
accounts.push((key1, account));
let instructions = vec![CompiledInstruction::new(1, &(), vec![0])];
let tx = Transaction::new_with_instructions(
let tx = Transaction::new_with_compiled_instructions(
&[&keypair],
&[],
Hash::default(),
@ -1131,7 +1131,7 @@ mod tests {
accounts.push((key0, account));
let instructions = vec![CompiledInstruction::new(1, &(), vec![0])];
let tx = Transaction::new_with_instructions(
let tx = Transaction::new_with_compiled_instructions(
&[&keypair],
&[],
Hash::default(),
@ -1166,7 +1166,7 @@ mod tests {
accounts.push((key1, account));
let instructions = vec![CompiledInstruction::new(0, &(), vec![0, 1])];
let tx = Transaction::new_with_instructions(
let tx = Transaction::new_with_compiled_instructions(
&[&keypair],
&[key1],
Hash::default(),
@ -1238,7 +1238,7 @@ mod tests {
accounts.push((key6, account));
let instructions = vec![CompiledInstruction::new(0, &(), vec![0])];
let tx = Transaction::new_with_instructions(
let tx = Transaction::new_with_compiled_instructions(
&[&keypair],
&[],
Hash::default(),
@ -1272,7 +1272,7 @@ mod tests {
accounts.push((key1, account));
let instructions = vec![CompiledInstruction::new(0, &(), vec![0])];
let tx = Transaction::new_with_instructions(
let tx = Transaction::new_with_compiled_instructions(
&[&keypair],
&[],
Hash::default(),
@ -1305,7 +1305,7 @@ mod tests {
accounts.push((key1, account));
let instructions = vec![CompiledInstruction::new(0, &(), vec![0])];
let tx = Transaction::new_with_instructions(
let tx = Transaction::new_with_compiled_instructions(
&[&keypair],
&[],
Hash::default(),
@ -1354,7 +1354,7 @@ mod tests {
CompiledInstruction::new(0, &(), vec![0]),
CompiledInstruction::new(1, &(), vec![0]),
];
let tx = Transaction::new_with_instructions(
let tx = Transaction::new_with_compiled_instructions(
&[&keypair],
&[],
Hash::default(),
@ -1398,7 +1398,7 @@ mod tests {
let instructions = vec![CompiledInstruction::new(0, &(), vec![0, 1])];
// Simulate pay-to-self transaction, which loads the same account twice
let tx = Transaction::new_with_instructions(
let tx = Transaction::new_with_compiled_instructions(
&[&keypair],
&[pubkey],
Hash::default(),

View File

@ -939,7 +939,7 @@ mod tests {
},
];
let t1 = Transaction::new_with_instructions(
let t1 = Transaction::new_with_compiled_instructions(
&[&mint_keypair],
&[key1, key2],
genesis_block.hash(),

View File

@ -18,7 +18,7 @@ impl LoaderTransaction {
fee: u64,
) -> Transaction {
let instruction = LoaderInstruction::Write { offset, bytes };
Transaction::new(
Transaction::new_signed(
from_keypair,
&[],
loader,
@ -35,7 +35,7 @@ impl LoaderTransaction {
fee: u64,
) -> Transaction {
let instruction = LoaderInstruction::Finalize;
Transaction::new(
Transaction::new_signed(
from_keypair,
&[],
loader,

View File

@ -25,7 +25,7 @@ impl SystemTransaction {
space,
program_id: *program_id,
};
Transaction::new(
Transaction::new_signed(
from_keypair,
&[*to],
&system_program::id(),
@ -64,7 +64,7 @@ impl SystemTransaction {
let assign = SystemInstruction::Assign {
program_id: *program_id,
};
Transaction::new(
Transaction::new_signed(
from_keypair,
&[],
&system_program::id(),
@ -82,7 +82,7 @@ impl SystemTransaction {
fee: u64,
) -> Transaction {
let move_lamports = SystemInstruction::Move { lamports };
Transaction::new(
Transaction::new_signed(
from_keypair,
&[*to],
&system_program::id(),
@ -108,7 +108,7 @@ impl SystemTransaction {
.collect();
let to_keys: Vec<_> = moves.iter().map(|(to_key, _)| *to_key).collect();
Transaction::new_with_instructions(
Transaction::new_with_compiled_instructions(
&[from],
&to_keys,
recent_blockhash,

View File

@ -167,7 +167,7 @@ pub struct Transaction {
}
impl Transaction {
pub fn new<S: Serialize, T: KeypairUtil>(
pub fn new_signed<S: Serialize, T: KeypairUtil>(
from_keypair: &T,
transaction_keys: &[Pubkey],
program_id: &Pubkey,
@ -212,7 +212,7 @@ impl Transaction {
/// * `fee` - The transaction fee.
/// * `program_ids` - The keys that identify programs used in the `instruction` vector.
/// * `instructions` - Instructions that will be executed atomically.
pub fn new_with_instructions<T: KeypairUtil>(
pub fn new_with_compiled_instructions<T: KeypairUtil>(
from_keypairs: &[&T],
keys: &[Pubkey],
recent_blockhash: Hash,
@ -500,7 +500,7 @@ mod tests {
CompiledInstruction::new(0, &(), vec![0, 1]),
CompiledInstruction::new(1, &(), vec![0, 2]),
];
let tx = Transaction::new_with_instructions(
let tx = Transaction::new_with_compiled_instructions(
&[&key],
&[key1, key2],
Hash::default(),
@ -535,7 +535,7 @@ mod tests {
fn test_refs_invalid_program_id() {
let key = Keypair::new();
let instructions = vec![CompiledInstruction::new(1, &(), vec![])];
let tx = Transaction::new_with_instructions(
let tx = Transaction::new_with_compiled_instructions(
&[&key],
&[],
Hash::default(),
@ -549,7 +549,7 @@ mod tests {
fn test_refs_invalid_account() {
let key = Keypair::new();
let instructions = vec![CompiledInstruction::new(0, &(), vec![1])];
let tx = Transaction::new_with_instructions(
let tx = Transaction::new_with_compiled_instructions(
&[&key],
&[],
Hash::default(),
@ -566,7 +566,7 @@ mod tests {
let keypair = Keypair::new();
let program_id = Pubkey::new(&[4; 32]);
let to = Pubkey::new(&[5; 32]);
let tx = Transaction::new(
let tx = Transaction::new_signed(
&keypair,
&[keypair.pubkey(), to],
&program_id,
@ -585,7 +585,7 @@ mod tests {
let keypair = Keypair::new();
let program_id = Pubkey::new(&[4; 32]);
let to = Pubkey::new(&[5; 32]);
let tx = Transaction::new(
let tx = Transaction::new_signed(
&keypair,
&[keypair.pubkey(), to],
&program_id,
@ -631,7 +631,7 @@ mod tests {
2, 2, 2,
]);
let tx = Transaction::new(
let tx = Transaction::new_signed(
&keypair,
&[to],
&program_id,