From 0991665ed3e44310e3608239e81d18f552bdc2bf Mon Sep 17 00:00:00 2001 From: Lijun Wang <83639177+lijunwangs@users.noreply.github.com> Date: Sun, 21 Jan 2024 22:37:34 -0800 Subject: [PATCH] rename some functions --- streamer/src/nonblocking/quic.rs | 5 +++-- transaction-metrics-tracker/src/lib.rs | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/streamer/src/nonblocking/quic.rs b/streamer/src/nonblocking/quic.rs index abbaad6ebbc54a..90dd003604f1aa 100644 --- a/streamer/src/nonblocking/quic.rs +++ b/streamer/src/nonblocking/quic.rs @@ -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, @@ -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 diff --git a/transaction-metrics-tracker/src/lib.rs b/transaction-metrics-tracker/src/lib.rs index 9f3b65cbd95b0d..d589fddbdeb625 100644 --- a/transaction-metrics-tracker/src/lib.rs +++ b/transaction-metrics-tracker/src/lib.rs @@ -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); @@ -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