block_hash => blockhash

This commit is contained in:
Michael Vines
2019-03-02 10:25:16 -08:00
committed by Greg Fitzgerald
parent 0f1582c196
commit a94880574b
55 changed files with 591 additions and 597 deletions

View File

@ -102,7 +102,7 @@ pub fn sample_tx_count(
/// Send loopback payment of 0 tokens and confirm the network processed it
pub fn send_barrier_transaction(
barrier_client: &mut ThinClient,
block_hash: &mut Hash,
blockhash: &mut Hash,
id: &Keypair,
) {
let transfer_start = Instant::now();
@ -116,9 +116,9 @@ pub fn send_barrier_transaction(
);
}
*block_hash = barrier_client.get_recent_block_hash();
*blockhash = barrier_client.get_recent_blockhash();
let signature = barrier_client
.transfer(0, &id, id.pubkey(), block_hash)
.transfer(0, &id, id.pubkey(), blockhash)
.expect("Unable to send barrier transaction");
let confirmatiom = barrier_client.poll_for_signature(&signature);
@ -158,13 +158,13 @@ pub fn send_barrier_transaction(
exit(1);
}
let new_block_hash = barrier_client.get_recent_block_hash();
if new_block_hash == *block_hash {
let new_blockhash = barrier_client.get_recent_blockhash();
if new_blockhash == *blockhash {
if poll_count > 0 && poll_count % 8 == 0 {
println!("block_hash is not advancing, still at {:?}", *block_hash);
println!("blockhash is not advancing, still at {:?}", *blockhash);
}
} else {
*block_hash = new_block_hash;
*blockhash = new_blockhash;
}
poll_count += 1;
@ -180,7 +180,7 @@ pub fn generate_txs(
leader: &NodeInfo,
) {
let mut client = mk_client(leader);
let block_hash = client.get_recent_block_hash();
let blockhash = client.get_recent_blockhash();
let tx_count = source.len();
println!("Signing transactions... {} (reclaim={})", tx_count, reclaim);
let signing_start = Instant::now();
@ -194,7 +194,7 @@ pub fn generate_txs(
.par_iter()
.map(|(id, keypair)| {
(
SystemTransaction::new_account(id, keypair.pubkey(), 1, block_hash, 0),
SystemTransaction::new_account(id, keypair.pubkey(), 1, blockhash, 0),
timestamp(),
)
})
@ -209,7 +209,7 @@ pub fn generate_txs(
bsps * 1_000_000_f64,
nsps / 1_000_f64,
duration_as_ms(&duration),
block_hash,
blockhash,
);
solana_metrics::submit(
influxdb::Point::new("bench-tps")
@ -332,7 +332,7 @@ pub fn fund_keys(client: &mut ThinClient, source: &Keypair, dests: &[Keypair], t
}
}
// try to transfer a "few" at a time with recent block_hash
// try to transfer a "few" at a time with recent blockhash
// assume 4MB network buffers, and 512 byte packets
const FUND_CHUNK_LEN: usize = 4 * 1024 * 1024 / 512;
@ -370,11 +370,11 @@ pub fn fund_keys(client: &mut ThinClient, source: &Keypair, dests: &[Keypair], t
to_fund_txs.len(),
);
let block_hash = client.get_recent_block_hash();
let blockhash = client.get_recent_blockhash();
// re-sign retained to_fund_txes with updated block_hash
// re-sign retained to_fund_txes with updated blockhash
to_fund_txs.par_iter_mut().for_each(|(k, tx)| {
tx.sign(&[*k], block_hash);
tx.sign(&[*k], blockhash);
});
to_fund_txs.iter().for_each(|(_, tx)| {
@ -414,8 +414,8 @@ pub fn airdrop_tokens(
id.pubkey(),
);
let block_hash = client.get_recent_block_hash();
match request_airdrop_transaction(&drone_addr, &id.pubkey(), airdrop_amount, block_hash) {
let blockhash = client.get_recent_blockhash();
match request_airdrop_transaction(&drone_addr, &id.pubkey(), airdrop_amount, blockhash) {
Ok(transaction) => {
let signature = client.transfer_signed(&transaction).unwrap();
client.poll_for_signature(&signature).unwrap();

View File

@ -170,8 +170,8 @@ fn main() {
airdrop_tokens(&mut barrier_client, &drone_addr, &barrier_id, 1);
println!("Get last ID...");
let mut block_hash = client.get_recent_block_hash();
println!("Got last ID {:?}", block_hash);
let mut blockhash = client.get_recent_blockhash();
println!("Got last ID {:?}", blockhash);
let first_tx_count = client.transaction_count();
println!("Initial transaction count {}", first_tx_count);
@ -254,7 +254,7 @@ fn main() {
// It's not feasible (would take too much time) to confirm each of the `tx_count / 2`
// transactions sent by `generate_txs()` so instead send and confirm a single transaction
// to validate the network is still functional.
send_barrier_transaction(&mut barrier_client, &mut block_hash, &barrier_id);
send_barrier_transaction(&mut barrier_client, &mut blockhash, &barrier_id);
i += 1;
if should_switch_directions(num_tokens_per_account, i) {