new_singleton -> new_with_instruction

This commit is contained in:
Greg Fitzgerald 2019-03-14 21:36:32 -06:00
parent 142eeffe5d
commit 42d5dde5b1
2 changed files with 5 additions and 5 deletions

View File

@ -21,7 +21,7 @@ fn test_system_unsigned_transaction() {
// Fund to account to bypass AccountNotFound error
let ix = SystemInstruction::new_move(&from_pubkey, &to_pubkey, 50);
let mut tx = TransactionBuilder::new_singleton(ix);
let mut tx = TransactionBuilder::new_with_instruction(ix);
alice_client.process_transaction(&mut tx).unwrap();
// Erroneously sign transaction with recipient account key
@ -31,7 +31,7 @@ fn test_system_unsigned_transaction() {
&SystemInstruction::Move { lamports: 10 },
vec![(from_pubkey, false), (to_pubkey, true)],
);
let mut tx = TransactionBuilder::new_singleton(ix);
let mut tx = TransactionBuilder::new_with_instruction(ix);
assert_eq!(
mallory_client.process_transaction(&mut tx),
Err(TransactionError::InstructionError(

View File

@ -51,7 +51,7 @@ impl TransactionBuilder {
}
/// Create a new unsigned transaction from a single instruction
pub fn new_singleton(instruction: BuilderInstruction) -> Transaction {
pub fn new_with_instruction(instruction: BuilderInstruction) -> Transaction {
Self::default().push(instruction).compile()
}
@ -256,10 +256,10 @@ mod tests {
}
#[test]
fn test_transaction_builder_new_singleton() {
fn test_transaction_builder_new_with_instruction() {
let ix = Instruction::new(Pubkey::default(), &0, vec![]);
assert_eq!(
TransactionBuilder::new_singleton(ix.clone()),
TransactionBuilder::new_with_instruction(ix.clone()),
TransactionBuilder::default().push(ix.clone()).compile()
);
}