cleanup
This commit is contained in:
parent
c9147d850b
commit
c01fc3efed
|
@ -584,7 +584,6 @@ dependencies = [
|
||||||
"rand 0.8.5",
|
"rand 0.8.5",
|
||||||
"rand_chacha 0.3.1",
|
"rand_chacha 0.3.1",
|
||||||
"reqwest",
|
"reqwest",
|
||||||
"scopeguard",
|
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"solana-lite-rpc-util",
|
"solana-lite-rpc-util",
|
||||||
|
|
|
@ -42,7 +42,6 @@ spl-memo = "4.0.0"
|
||||||
url = "*"
|
url = "*"
|
||||||
reqwest = "0.11.26"
|
reqwest = "0.11.26"
|
||||||
lazy_static = "1.4.0"
|
lazy_static = "1.4.0"
|
||||||
scopeguard = "1.2.0"
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
bincode = { workspace = true }
|
bincode = { workspace = true }
|
||||||
|
|
|
@ -18,7 +18,6 @@ use std::str::FromStr;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use dashmap::mapref::multiple::RefMulti;
|
use dashmap::mapref::multiple::RefMulti;
|
||||||
use scopeguard::defer;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_json::json;
|
use serde_json::json;
|
||||||
use solana_rpc_client_api::response::{Response, RpcBlockUpdate, RpcResponseContext, SlotUpdate};
|
use solana_rpc_client_api::response::{Response, RpcBlockUpdate, RpcResponseContext, SlotUpdate};
|
||||||
|
@ -66,8 +65,7 @@ pub async fn send_and_confirm_bulk_transactions(
|
||||||
};
|
};
|
||||||
|
|
||||||
// note: we get confirmed but never finaliized
|
// 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;
|
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 started_at = Instant::now();
|
let started_at = Instant::now();
|
||||||
trace!(
|
trace!(
|
||||||
|
|
|
@ -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: 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 jh = tokio::spawn(async move {
|
||||||
let started_at = Instant::now();
|
let started_at = Instant::now();
|
||||||
|
|
||||||
|
@ -57,11 +57,15 @@ pub async fn start_tx_status_collector(ws_url: Url, payer_pubkey: Pubkey, commit
|
||||||
serde_json::from_str(&payload).unwrap();
|
serde_json::from_str(&payload).unwrap();
|
||||||
let block_update = ws_result.params.result;
|
let block_update = ws_result.params.result;
|
||||||
let slot = block_update.value.slot;
|
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) {
|
if let Some(tx_sigs_from_block) = block_update.value.block.and_then(|b| b.signatures) {
|
||||||
for tx_sig in tx_sigs_from_block {
|
for tx_sig in tx_sigs_from_block {
|
||||||
let tx_sig = Signature::from_str(&tx_sig).unwrap();
|
let tx_sig = Signature::from_str(&tx_sig).unwrap();
|
||||||
debug!("Transaction signature found in block: {} - slot {}", tx_sig, slot);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue