Rename tokens to lamports in core/

This commit is contained in:
Michael Vines 2019-03-05 16:58:52 -08:00
parent 53f09c44f3
commit f1d1852691
7 changed files with 18 additions and 19 deletions

View File

@ -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);

View File

@ -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<Keypair>,
token_source: &Keypair,
lamport_source: &Keypair,
stake: u64,
slot_to_vote_on: u64,
blockhash: &Hash,
num_ending_ticks: u64,
) -> (Vec<Entry>, 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,

View File

@ -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,

View File

@ -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);

View File

@ -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<Transaction, Error> {
if tokens == 0 {
if lamports == 0 {
Err(Error::new(ErrorKind::Other, "Airdrop failed"))?
}
let key = Keypair::new();

View File

@ -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();

View File

@ -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);
}
}