Skip to content

Commit

Permalink
send transaction just to upcoming leaders
Browse files Browse the repository at this point in the history
  • Loading branch information
gregcusack committed Jun 12, 2024
1 parent 8a1d35b commit 3d3f905
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 20 deletions.
21 changes: 7 additions & 14 deletions local-cluster/src/cluster_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ pub fn spend_and_verify_all_nodes<S: ::std::hash::BuildHasher + Sync + Send>(
let transaction =
system_transaction::transfer(funding_keypair, &random_keypair.pubkey(), 1, blockhash);
let confs = VOTE_THRESHOLD_DEPTH + 1;
let sig = client
client
.send_transaction_to_upcoming_leaders(&transaction)
.unwrap();
for validator in &cluster_nodes {
Expand All @@ -114,7 +114,7 @@ pub fn spend_and_verify_all_nodes<S: ::std::hash::BuildHasher + Sync + Send>(
let client = new_tpu_quic_client(ingress_node, connection_cache.clone()).unwrap();
client
.rpc_client()
.poll_for_signature_confirmation(&sig, confs)
.poll_for_signature_confirmation(&transaction.signatures[0], confs)
.unwrap();
}
});
Expand Down Expand Up @@ -300,23 +300,16 @@ pub fn kill_entry_and_spend_and_verify_rest(
);

let confs = VOTE_THRESHOLD_DEPTH + 1;
let sig = {
let sig = client.send_transaction_to_upcoming_leaders(&transaction);
match sig {
Err(e) => {
result = Err(e);
continue;
}

Ok(sig) => sig,
}
};
if let Err(e) = client.send_transaction_to_upcoming_leaders(&transaction) {
result = Err(e);
continue;
}
info!("poll_all_nodes_for_signature()");
match poll_all_nodes_for_signature(
entry_point_info,
&cluster_nodes,
connection_cache,
&sig,
&transaction.signatures[0],
confs,
) {
Err(e) => {
Expand Down
6 changes: 2 additions & 4 deletions local-cluster/src/local_cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,21 @@ use {
},
solana_sdk::{
account::{Account, AccountSharedData},
clock::{Slot, DEFAULT_DEV_SLOTS_PER_EPOCH, DEFAULT_TICKS_PER_SLOT, MAX_PROCESSING_AGE},
clock::{Slot, DEFAULT_DEV_SLOTS_PER_EPOCH, DEFAULT_TICKS_PER_SLOT},
commitment_config::CommitmentConfig,
epoch_schedule::EpochSchedule,
feature_set,
genesis_config::{ClusterType, GenesisConfig},
message::Message,
poh_config::PohConfig,
pubkey::Pubkey,
signature::{Keypair, Signature, Signer},
signature::{Keypair, Signer},
stake::{
instruction as stake_instruction,
state::{Authorized, Lockup},
},
system_transaction,
transaction::Transaction,
transport::TransportError,
},
solana_stake_program::stake_state,
solana_streamer::{socket::SocketAddrSpace, streamer::StakedNodes},
Expand All @@ -62,7 +61,6 @@ use {
net::{IpAddr, Ipv4Addr, UdpSocket},
path::{Path, PathBuf},
sync::{Arc, RwLock},
time::Instant,
},
};

Expand Down
4 changes: 2 additions & 2 deletions tpu-client/src/tpu_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ where
pub fn send_transaction_to_upcoming_leaders(
&self,
transaction: &Transaction,
) -> TransportResult<Signature> {
) -> TransportResult<()> {
let wire_transaction =
bincode::serialize(&transaction).expect("should serialize transaction");

Expand All @@ -126,7 +126,7 @@ where
conn.send_data_async(wire_transaction.clone())?;
}

Ok(transaction.signatures[0])
Ok(())
}

/// Serialize and send a batch of transactions to the current and upcoming leader TPUs according
Expand Down

0 comments on commit 3d3f905

Please sign in to comment.