Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
grooviegermanikus committed Jun 19, 2024
1 parent c9147d8 commit c01fc3e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ spl-memo = "4.0.0"
url = "*"
reqwest = "0.11.26"
lazy_static = "1.4.0"
scopeguard = "1.2.0"

[dev-dependencies]
bincode = { workspace = true }
4 changes: 1 addition & 3 deletions bench/src/benches/rpc_interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ use std::str::FromStr;
use std::sync::Arc;
use std::time::Duration;
use dashmap::mapref::multiple::RefMulti;
use scopeguard::defer;
use serde::{Deserialize, Serialize};
use serde_json::json;
use solana_rpc_client_api::response::{Response, RpcBlockUpdate, RpcResponseContext, SlotUpdate};
Expand Down Expand Up @@ -66,8 +65,7 @@ pub async fn send_and_confirm_bulk_transactions(
};

// note: we get confirmed but never finaliized
let (tx_status_map, jh_collector) = start_tx_status_collector(tx_status_websocket_addr.clone(), payer_pubkey, CommitmentConfig::confirmed()).await;
defer!(jh_collector.abort());
let (tx_status_map, _jh_collector) = start_tx_status_collector(tx_status_websocket_addr.clone(), payer_pubkey, CommitmentConfig::confirmed()).await;

let started_at = Instant::now();
trace!(
Expand Down
8 changes: 6 additions & 2 deletions bench/src/benches/tx_status_websocket_collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pub async fn start_tx_status_collector(ws_url: Url, payer_pubkey: Pubkey, commit

let observed_transactions: Arc<DashMap<Signature, Slot>> = Arc::new(DashMap::with_capacity(64));

let observed_transactions_write = observed_transactions.clone();
let observed_transactions_write = Arc::downgrade(&observed_transactions);
let jh = tokio::spawn(async move {
let started_at = Instant::now();

Expand All @@ -57,11 +57,15 @@ pub async fn start_tx_status_collector(ws_url: Url, payer_pubkey: Pubkey, commit
serde_json::from_str(&payload).unwrap();
let block_update = ws_result.params.result;
let slot = block_update.value.slot;
let Some(map) = observed_transactions_write.upgrade() else {
debug!("observed_transactions map dropped - stopping task");
return;
};
if let Some(tx_sigs_from_block) = block_update.value.block.and_then(|b| b.signatures) {
for tx_sig in tx_sigs_from_block {
let tx_sig = Signature::from_str(&tx_sig).unwrap();
debug!("Transaction signature found in block: {} - slot {}", tx_sig, slot);
observed_transactions_write.entry(tx_sig).or_insert(slot);
map.entry(tx_sig).or_insert(slot);
}
}
}
Expand Down

0 comments on commit c01fc3e

Please sign in to comment.