Skip to content

Commit

Permalink
rename some functions
Browse files Browse the repository at this point in the history
  • Loading branch information
lijunwangs committed Jan 22, 2024
1 parent 505f88a commit 0991665
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions streamer/src/nonblocking/quic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use {
signature::{Keypair, Signature},
timing,
},
solana_transaction_metrics_tracker::{get_signature_from_packet, track_packet},
solana_transaction_metrics_tracker::{check_track_packet, get_signature_from_packet},
std::{
collections::HashMap,
iter::repeat_with,
Expand Down Expand Up @@ -698,7 +698,8 @@ async fn packet_batch_sender(

total_bytes += packet_batch[i].meta().size;

let (do_track, signature) = track_packet(&packet_batch[i]).unwrap_or((false, None));
let (do_track, signature) =
check_track_packet(&packet_batch[i]).unwrap_or((false, None));
if do_track {
packet_perf_measure.insert(*signature.unwrap(), packet_accumulator.start_time);
// we set the PERF_TRACK_PACKET on
Expand Down
6 changes: 3 additions & 3 deletions transaction-metrics-tracker/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ lazy_static! {

/// Check if a transaction given its signature matches the randomly selected mask.
/// The signaure should be from the reference of Signature
pub fn track_transaction(signature: &[u8; SIGNATURE_BYTES]) -> bool {
pub fn check_track_transaction(signature: &[u8; SIGNATURE_BYTES]) -> bool {
// We do not use the highest signature byte as it is not really random
let match_portion: u16 = ((signature[62] as u16) << 8 | signature[61] as u16) >> 4;
trace!("Matching txn: {match_portion:b} {:b}", *TXN_MASK);
Expand All @@ -24,11 +24,11 @@ pub fn track_transaction(signature: &[u8; SIGNATURE_BYTES]) -> bool {
/// Check if a transaction packet's signature matches the mask.
/// This does a rudimentry verification to make sure the packet at least
/// contains the signature data and it returns the reference to the signature.
pub fn track_packet(
pub fn check_track_packet(
packet: &Packet,
) -> Result<(bool, Option<&[u8; SIGNATURE_BYTES]>), PacketError> {
let signature = get_signature_from_packet(packet)?;
Ok((track_transaction(signature), Some(signature)))
Ok((check_track_transaction(signature), Some(signature)))
}

/// Get the signature of the transaction packet
Expand Down

0 comments on commit 0991665

Please sign in to comment.