From f1d1852691060260fd819c52fdeeb07f5a206885 Mon Sep 17 00:00:00 2001 From: Michael Vines Date: Tue, 5 Mar 2019 16:58:52 -0800 Subject: [PATCH] Rename tokens to lamports in core/ --- core/src/banking_stage.rs | 6 +++--- core/src/fullnode.rs | 6 +++--- core/src/local_cluster.rs | 2 +- core/src/replicator.rs | 4 ++-- core/src/rpc_mock.rs | 4 ++-- core/src/staking_utils.rs | 6 +++--- core/src/voting_keypair.rs | 9 ++++----- 7 files changed, 18 insertions(+), 19 deletions(-) diff --git a/core/src/banking_stage.rs b/core/src/banking_stage.rs index 25a7d3511a..da1d2254b4 100644 --- a/core/src/banking_stage.rs +++ b/core/src/banking_stage.rs @@ -491,7 +491,7 @@ mod tests { poh_recorder.lock().unwrap().set_bank(&bank); let _banking_stage = BankingStage::new(&cluster_info, &poh_recorder, verified_receiver); - // Process a batch that includes a transaction that receives two tokens. + // Process a batch that includes a transaction that receives two lamports. let alice = Keypair::new(); let tx = SystemTransaction::new_account( &mint_keypair, @@ -506,7 +506,7 @@ mod tests { .send(vec![(packets[0].clone(), vec![1u8])]) .unwrap(); - // Process a second batch that spends one of those tokens. + // Process a second batch that spends one of those lamports. let tx = SystemTransaction::new_account( &alice, mint_keypair.pubkey(), @@ -532,7 +532,7 @@ mod tests { // same assertion as running through the bank, really... assert!(entries.len() >= 2); - // Assert the user holds one token, not two. If the stage only outputs one + // Assert the user holds one lamport, not two. If the stage only outputs one // entry, then the second transaction will be rejected, because it drives // the account balance below zero before the credit is added. let bank = Bank::new(&genesis_block); diff --git a/core/src/fullnode.rs b/core/src/fullnode.rs index 04a8044ce2..eb8fca5ed2 100644 --- a/core/src/fullnode.rs +++ b/core/src/fullnode.rs @@ -329,15 +329,15 @@ impl Service for Fullnode { // leader selection, and append `num_ending_ticks` empty tick entries. pub fn make_active_set_entries( active_keypair: &Arc, - token_source: &Keypair, + lamport_source: &Keypair, stake: u64, slot_to_vote_on: u64, blockhash: &Hash, num_ending_ticks: u64, ) -> (Vec, Keypair) { - // 1) Assume the active_keypair node has no tokens staked + // 1) Assume the active_keypair node has no lamports staked let transfer_tx = SystemTransaction::new_account( - &token_source, + &lamport_source, active_keypair.pubkey(), stake, *blockhash, diff --git a/core/src/local_cluster.rs b/core/src/local_cluster.rs index 15c47e81fa..b6541b6894 100644 --- a/core/src/local_cluster.rs +++ b/core/src/local_cluster.rs @@ -71,7 +71,7 @@ impl LocalCluster { let ledger_path = tmp_copy_blocktree!(&genesis_ledger_path); ledger_paths.push(ledger_path.clone()); - // Send each validator some tokens to vote + // Send each validator some lamports to vote let validator_balance = Self::transfer( &mut client, &mint_keypair, diff --git a/core/src/replicator.rs b/core/src/replicator.rs index b84f51c182..827d1239a5 100644 --- a/core/src/replicator.rs +++ b/core/src/replicator.rs @@ -214,7 +214,7 @@ impl Replicator { let mut client = mk_client(&leader); - Self::get_airdrop_tokens(&mut client, keypair, &leader_info); + Self::get_airdrop_lamports(&mut client, keypair, &leader_info); info!("Done downloading ledger at {}", ledger_path); let ledger_path = Path::new(ledger_path); @@ -358,7 +358,7 @@ impl Replicator { ))? } - fn get_airdrop_tokens(client: &mut ThinClient, keypair: &Keypair, leader_info: &NodeInfo) { + fn get_airdrop_lamports(client: &mut ThinClient, keypair: &Keypair, leader_info: &NodeInfo) { if retry_get_balance(client, &keypair.pubkey(), None).is_none() { let mut drone_addr = leader_info.tpu; drone_addr.set_port(DRONE_PORT); diff --git a/core/src/rpc_mock.rs b/core/src/rpc_mock.rs index 1fbf03312c..2fde6bcab0 100644 --- a/core/src/rpc_mock.rs +++ b/core/src/rpc_mock.rs @@ -97,10 +97,10 @@ impl RpcRequestHandler for MockRpcClient { pub fn request_airdrop_transaction( _drone_addr: &SocketAddr, _id: &Pubkey, - tokens: u64, + lamports: u64, _blockhash: Hash, ) -> Result { - if tokens == 0 { + if lamports == 0 { Err(Error::new(ErrorKind::Other, "Airdrop failed"))? } let key = Keypair::new(); diff --git a/core/src/staking_utils.rs b/core/src/staking_utils.rs index 45fb519374..f8ef25c62f 100644 --- a/core/src/staking_utils.rs +++ b/core/src/staking_utils.rs @@ -152,9 +152,9 @@ mod tests { #[test] fn test_bank_staked_nodes_at_epoch() { let pubkey = Keypair::new().pubkey(); - let bootstrap_tokens = 3; + let bootstrap_lamports = 3; let (genesis_block, _) = - GenesisBlock::new_with_leader(bootstrap_tokens, pubkey, bootstrap_tokens); + GenesisBlock::new_with_leader(bootstrap_lamports, pubkey, bootstrap_lamports); let bank = Bank::new(&genesis_block); // Epoch doesn't exist @@ -181,7 +181,7 @@ mod tests { let bank_voter = Keypair::new(); // Give the validator some stake but don't setup a staking account - // Validator has no tokens staked, so they get filtered out. Only the bootstrap leader + // Validator has no lamports staked, so they get filtered out. Only the bootstrap leader // created by the genesis block will get included bank.transfer(1, &mint_keypair, validator.pubkey(), genesis_block.hash()) .unwrap(); diff --git a/core/src/voting_keypair.rs b/core/src/voting_keypair.rs index fbc7a894c1..0baaee9f2b 100644 --- a/core/src/voting_keypair.rs +++ b/core/src/voting_keypair.rs @@ -106,11 +106,10 @@ pub mod tests { from_keypair: &Keypair, voting_pubkey: &Pubkey, bank: &Bank, - num_tokens: u64, + lamports: u64, ) { let blockhash = bank.last_blockhash(); - let tx = - VoteTransaction::new_account(from_keypair, *voting_pubkey, blockhash, num_tokens, 0); + let tx = VoteTransaction::new_account(from_keypair, *voting_pubkey, blockhash, lamports, 0); bank.process_transaction(&tx).unwrap(); } @@ -124,10 +123,10 @@ pub mod tests { from_keypair: &Keypair, voting_keypair: &T, bank: &Bank, - num_tokens: u64, + lamports: u64, slot: u64, ) { - new_vote_account(from_keypair, &voting_keypair.pubkey(), bank, num_tokens); + new_vote_account(from_keypair, &voting_keypair.pubkey(), bank, lamports); push_vote(voting_keypair, bank, slot); } }