Purge remaining last_id (now called block_hash)
This commit is contained in:
committed by
Greg Fitzgerald
parent
2bfad87a5f
commit
258cf21416
@ -100,7 +100,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, last_id: &mut Hash, id: &Keypair) {
|
||||
pub fn send_barrier_transaction(barrier_client: &mut ThinClient, block_hash: &mut Hash, id: &Keypair) {
|
||||
let transfer_start = Instant::now();
|
||||
|
||||
let mut poll_count = 0;
|
||||
@ -112,9 +112,9 @@ pub fn send_barrier_transaction(barrier_client: &mut ThinClient, last_id: &mut H
|
||||
);
|
||||
}
|
||||
|
||||
*last_id = barrier_client.get_recent_block_hash();
|
||||
*block_hash = barrier_client.get_recent_block_hash();
|
||||
let signature = barrier_client
|
||||
.transfer(0, &id, id.pubkey(), last_id)
|
||||
.transfer(0, &id, id.pubkey(), block_hash)
|
||||
.expect("Unable to send barrier transaction");
|
||||
|
||||
let confirmatiom = barrier_client.poll_for_signature(&signature);
|
||||
@ -154,13 +154,13 @@ pub fn send_barrier_transaction(barrier_client: &mut ThinClient, last_id: &mut H
|
||||
exit(1);
|
||||
}
|
||||
|
||||
let new_last_id = barrier_client.get_recent_block_hash();
|
||||
if new_last_id == *last_id {
|
||||
let new_block_hash = barrier_client.get_recent_block_hash();
|
||||
if new_block_hash == *block_hash {
|
||||
if poll_count > 0 && poll_count % 8 == 0 {
|
||||
println!("last_id is not advancing, still at {:?}", *last_id);
|
||||
println!("block_hash is not advancing, still at {:?}", *block_hash);
|
||||
}
|
||||
} else {
|
||||
*last_id = new_last_id;
|
||||
*block_hash = new_block_hash;
|
||||
}
|
||||
|
||||
poll_count += 1;
|
||||
@ -176,7 +176,7 @@ pub fn generate_txs(
|
||||
leader: &NodeInfo,
|
||||
) {
|
||||
let mut client = mk_client(leader);
|
||||
let last_id = client.get_recent_block_hash();
|
||||
let block_hash = client.get_recent_block_hash();
|
||||
let tx_count = source.len();
|
||||
println!("Signing transactions... {} (reclaim={})", tx_count, reclaim);
|
||||
let signing_start = Instant::now();
|
||||
@ -190,7 +190,7 @@ pub fn generate_txs(
|
||||
.par_iter()
|
||||
.map(|(id, keypair)| {
|
||||
(
|
||||
SystemTransaction::new_account(id, keypair.pubkey(), 1, last_id, 0),
|
||||
SystemTransaction::new_account(id, keypair.pubkey(), 1, block_hash, 0),
|
||||
timestamp(),
|
||||
)
|
||||
})
|
||||
@ -205,7 +205,7 @@ pub fn generate_txs(
|
||||
bsps * 1_000_000_f64,
|
||||
nsps / 1_000_f64,
|
||||
duration_as_ms(&duration),
|
||||
last_id,
|
||||
block_hash,
|
||||
);
|
||||
solana_metrics::submit(
|
||||
influxdb::Point::new("bench-tps")
|
||||
@ -328,7 +328,7 @@ pub fn fund_keys(client: &mut ThinClient, source: &Keypair, dests: &[Keypair], t
|
||||
}
|
||||
}
|
||||
|
||||
// try to transfer a "few" at a time with recent last_id
|
||||
// try to transfer a "few" at a time with recent block_hash
|
||||
// assume 4MB network buffers, and 512 byte packets
|
||||
const FUND_CHUNK_LEN: usize = 4 * 1024 * 1024 / 512;
|
||||
|
||||
@ -366,11 +366,11 @@ pub fn fund_keys(client: &mut ThinClient, source: &Keypair, dests: &[Keypair], t
|
||||
to_fund_txs.len(),
|
||||
);
|
||||
|
||||
let last_id = client.get_recent_block_hash();
|
||||
let block_hash = client.get_recent_block_hash();
|
||||
|
||||
// re-sign retained to_fund_txes with updated last_id
|
||||
// re-sign retained to_fund_txes with updated block_hash
|
||||
to_fund_txs.par_iter_mut().for_each(|(k, tx)| {
|
||||
tx.sign(&[*k], last_id);
|
||||
tx.sign(&[*k], block_hash);
|
||||
});
|
||||
|
||||
to_fund_txs.iter().for_each(|(_, tx)| {
|
||||
@ -410,8 +410,8 @@ pub fn airdrop_tokens(
|
||||
id.pubkey(),
|
||||
);
|
||||
|
||||
let last_id = client.get_recent_block_hash();
|
||||
match request_airdrop_transaction(&drone_addr, &id.pubkey(), airdrop_amount, last_id) {
|
||||
let block_hash = client.get_recent_block_hash();
|
||||
match request_airdrop_transaction(&drone_addr, &id.pubkey(), airdrop_amount, block_hash) {
|
||||
Ok(transaction) => {
|
||||
let signature = client.transfer_signed(&transaction).unwrap();
|
||||
client.poll_for_signature(&signature).unwrap();
|
||||
|
@ -170,8 +170,8 @@ fn main() {
|
||||
airdrop_tokens(&mut barrier_client, &drone_addr, &barrier_id, 1);
|
||||
|
||||
println!("Get last ID...");
|
||||
let mut last_id = client.get_recent_block_hash();
|
||||
println!("Got last ID {:?}", last_id);
|
||||
let mut block_hash = client.get_recent_block_hash();
|
||||
println!("Got last ID {:?}", block_hash);
|
||||
|
||||
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 last_id, &barrier_id);
|
||||
send_barrier_transaction(&mut barrier_client, &mut block_hash, &barrier_id);
|
||||
|
||||
i += 1;
|
||||
if should_switch_directions(num_tokens_per_account, i) {
|
||||
|
Reference in New Issue
Block a user