diff --git a/src/bank.rs b/src/bank.rs index 2a6a97f3af..25c27e64c7 100644 --- a/src/bank.rs +++ b/src/bank.rs @@ -239,11 +239,11 @@ impl Bank { } /// Process a batch of transactions. - pub fn process_transactions(&self, trs: Vec) -> Vec> { + pub fn process_transactions(&self, txs: Vec) -> Vec> { // Run all debits first to filter out any transactions that can't be processed // in parallel deterministically. - info!("processing Transactions {}", trs.len()); - let results: Vec<_> = trs.into_par_iter() + info!("processing Transactions {}", txs.len()); + let results: Vec<_> = txs.into_par_iter() .map(|tx| self.apply_debits(&tx).map(|_| tx)) .collect(); // Calling collect() here forces all debits to complete before moving on. @@ -560,10 +560,10 @@ mod tests { let mint = Mint::new(2); let bank = Bank::new(&mint); let keypair = KeyPair::new(); - let tr0 = Transaction::new(&mint.keypair(), keypair.pubkey(), 2, mint.last_id()); - let tr1 = Transaction::new(&keypair, mint.pubkey(), 1, mint.last_id()); - let trs = vec![tr0, tr1]; - let results = bank.process_transactions(trs); + let tx0 = Transaction::new(&mint.keypair(), keypair.pubkey(), 2, mint.last_id()); + let tx1 = Transaction::new(&keypair, mint.pubkey(), 1, mint.last_id()); + let txs = vec![tx0, tx1]; + let results = bank.process_transactions(txs); assert!(results[1].is_err()); // Assert bad transactions aren't counted. diff --git a/src/entry.rs b/src/entry.rs index b985932f28..4c7693874c 100644 --- a/src/entry.rs +++ b/src/entry.rs @@ -129,14 +129,14 @@ mod tests { // First, verify entries let keypair = KeyPair::new(); - let tr0 = Transaction::new(&keypair, keypair.pubkey(), 0, zero); - let tr1 = Transaction::new(&keypair, keypair.pubkey(), 1, zero); - let mut e0 = Entry::new(&zero, 0, vec![tr0.clone(), tr1.clone()]); + let tx0 = Transaction::new(&keypair, keypair.pubkey(), 0, zero); + let tx1 = Transaction::new(&keypair, keypair.pubkey(), 1, zero); + let mut e0 = Entry::new(&zero, 0, vec![tx0.clone(), tx1.clone()]); assert!(e0.verify(&zero)); // Next, swap two transactions and ensure verification fails. - e0.transactions[0] = tr1; // <-- attack - e0.transactions[1] = tr0; + e0.transactions[0] = tx1; // <-- attack + e0.transactions[1] = tx0; assert!(!e0.verify(&zero)); } @@ -146,14 +146,14 @@ mod tests { // First, verify entries let keypair = KeyPair::new(); - let tr0 = Transaction::new_timestamp(&keypair, Utc::now(), zero); - let tr1 = Transaction::new_signature(&keypair, Default::default(), zero); - let mut e0 = Entry::new(&zero, 0, vec![tr0.clone(), tr1.clone()]); + let tx0 = Transaction::new_timestamp(&keypair, Utc::now(), zero); + let tx1 = Transaction::new_signature(&keypair, Default::default(), zero); + let mut e0 = Entry::new(&zero, 0, vec![tx0.clone(), tx1.clone()]); assert!(e0.verify(&zero)); // Next, swap two witness transactions and ensure verification fails. - e0.transactions[0] = tr1; // <-- attack - e0.transactions[1] = tr0; + e0.transactions[0] = tx1; // <-- attack + e0.transactions[1] = tx0; assert!(!e0.verify(&zero)); } diff --git a/src/ledger.rs b/src/ledger.rs index 5819082f23..e0d86438bb 100644 --- a/src/ledger.rs +++ b/src/ledger.rs @@ -155,8 +155,8 @@ mod tests { let zero = Hash::default(); let one = hash(&zero); let keypair = KeyPair::new(); - let tr0 = Transaction::new(&keypair, keypair.pubkey(), 1, one); - let transactions = vec![tr0.clone(); 10000]; + let tx0 = Transaction::new(&keypair, keypair.pubkey(), 1, one); + let transactions = vec![tx0.clone(); 10000]; let e0 = Entry::new(&zero, 0, transactions); let entry_list = vec![e0.clone(); 1]; @@ -173,8 +173,8 @@ mod tests { let mut id = Hash::default(); let next_id = hash(&id); let keypair = KeyPair::new(); - let tr0 = Transaction::new(&keypair, keypair.pubkey(), 1, next_id); - let transactions = vec![tr0.clone(); 5]; + let tx0 = Transaction::new(&keypair, keypair.pubkey(), 1, next_id); + let transactions = vec![tx0.clone(); 5]; let transaction_batches = vec![transactions.clone(); 5]; let entries0 = next_entries(&id, 0, transaction_batches); diff --git a/src/transaction.rs b/src/transaction.rs index f5da50c3ac..02fee0b52f 100644 --- a/src/transaction.rs +++ b/src/transaction.rs @@ -162,8 +162,8 @@ mod tests { fn test_claim() { let keypair = KeyPair::new(); let zero = Hash::default(); - let tr0 = Transaction::new(&keypair, keypair.pubkey(), 42, zero); - assert!(tr0.verify_plan()); + let tx0 = Transaction::new(&keypair, keypair.pubkey(), 42, zero); + assert!(tx0.verify_plan()); } #[test] @@ -172,8 +172,8 @@ mod tests { let keypair0 = KeyPair::new(); let keypair1 = KeyPair::new(); let pubkey1 = keypair1.pubkey(); - let tr0 = Transaction::new(&keypair0, pubkey1, 42, zero); - assert!(tr0.verify_plan()); + let tx0 = Transaction::new(&keypair0, pubkey1, 42, zero); + assert!(tx0.verify_plan()); } #[test] @@ -264,9 +264,9 @@ mod tests { let bob_pubkey = KeyPair::new().pubkey(); let carol_pubkey = KeyPair::new().pubkey(); let last_id = Hash::default(); - let tr0 = Transaction::new(&alice_keypair, bob_pubkey, 1, last_id); - let tr1 = Transaction::new(&alice_keypair, carol_pubkey, 1, last_id); - let transactions = vec![tr0, tr1]; + let tx0 = Transaction::new(&alice_keypair, bob_pubkey, 1, last_id); + let tx1 = Transaction::new(&alice_keypair, carol_pubkey, 1, last_id); + let transactions = vec![tx0, tx1]; assert!(verify_transactions(&transactions)); } } diff --git a/src/tvu.rs b/src/tvu.rs index 2b4e5696cb..8d4ac27c86 100644 --- a/src/tvu.rs +++ b/src/tvu.rs @@ -293,7 +293,7 @@ pub mod tests { bank.register_entry_id(&cur_hash); cur_hash = hash(&cur_hash); - let tr1 = Transaction::new( + let tx0 = Transaction::new( &mint.keypair(), bob_keypair.pubkey(), transfer_amount, @@ -301,7 +301,7 @@ pub mod tests { ); bank.register_entry_id(&cur_hash); cur_hash = hash(&cur_hash); - let entry1 = Entry::new(&cur_hash, i + num_blobs, vec![tr1]); + let entry1 = Entry::new(&cur_hash, i + num_blobs, vec![tx0]); bank.register_entry_id(&cur_hash); cur_hash = hash(&cur_hash);