Solving errors, making default rpc_client commitment as finalized
This commit is contained in:
parent
d29a936e92
commit
6b946ea4e9
|
@ -186,6 +186,9 @@ pub fn confirmation_by_lite_rpc_notification_stream(
|
||||||
|
|
||||||
match notification {
|
match notification {
|
||||||
NotificationMsg::BlockNotificationMsg(block_notification) => {
|
NotificationMsg::BlockNotificationMsg(block_notification) => {
|
||||||
|
if block_notification.commitment != CommitmentLevel::Finalized {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
let _ = tx_block_data.send(BlockData {
|
let _ = tx_block_data.send(BlockData {
|
||||||
block_hash: block_notification.blockhash.to_string(),
|
block_hash: block_notification.blockhash.to_string(),
|
||||||
block_leader: block_notification.block_leader,
|
block_leader: block_notification.block_leader,
|
||||||
|
@ -194,12 +197,15 @@ pub fn confirmation_by_lite_rpc_notification_stream(
|
||||||
number_of_mm_transactions: block_notification.transaction_found,
|
number_of_mm_transactions: block_notification.transaction_found,
|
||||||
total_transactions: block_notification.total_transactions,
|
total_transactions: block_notification.total_transactions,
|
||||||
cu_consumed: block_notification.total_cu_consumed,
|
cu_consumed: block_notification.total_cu_consumed,
|
||||||
cu_consumed_by_simulations: block_notification.cu_consumed_by_txs,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
NotificationMsg::UpdateTransactionMsg(tx_update_notifications) => {
|
NotificationMsg::UpdateTransactionMsg(tx_update_notifications) => {
|
||||||
|
|
||||||
for tx_notification in tx_update_notifications {
|
for tx_notification in tx_update_notifications {
|
||||||
|
if tx_notification.commitment != CommitmentLevel::Finalized {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(value) = transaction_map.get(&tx_notification.signature) {
|
if let Some(value) = transaction_map.get(&tx_notification.signature) {
|
||||||
let (tx_sent_record, _) = value.clone();
|
let (tx_sent_record, _) = value.clone();
|
||||||
let error = match &tx_notification.transaction_status {
|
let error = match &tx_notification.transaction_status {
|
||||||
|
|
|
@ -153,13 +153,14 @@ pub async fn main() -> anyhow::Result<()> {
|
||||||
|
|
||||||
let nb_rpc_client = Arc::new(NbRpcClient::new_with_commitment(
|
let nb_rpc_client = Arc::new(NbRpcClient::new_with_commitment(
|
||||||
json_rpc_url.to_string(),
|
json_rpc_url.to_string(),
|
||||||
CommitmentConfig::confirmed(),
|
CommitmentConfig::finalized(),
|
||||||
));
|
));
|
||||||
|
|
||||||
let tx_store = empty_tx_store();
|
let tx_store = empty_tx_store();
|
||||||
let block_store = BlockStore::new(&nb_rpc_client)
|
let block_store = BlockStore::new(&nb_rpc_client)
|
||||||
.await
|
.await
|
||||||
.expect("Blockstore should be created");
|
.expect("Blockstore should be created");
|
||||||
|
|
||||||
let (notif_sx, notif_rx) = unbounded_channel();
|
let (notif_sx, notif_rx) = unbounded_channel();
|
||||||
let (transaction_service, tx_service_jh) = configure_transaction_service(
|
let (transaction_service, tx_service_jh) = configure_transaction_service(
|
||||||
nb_rpc_client.clone(),
|
nb_rpc_client.clone(),
|
||||||
|
|
|
@ -102,5 +102,4 @@ pub struct BlockData {
|
||||||
pub number_of_mm_transactions: u64,
|
pub number_of_mm_transactions: u64,
|
||||||
pub block_time: u64,
|
pub block_time: u64,
|
||||||
pub cu_consumed: u64,
|
pub cu_consumed: u64,
|
||||||
pub cu_consumed_by_simulations: u64,
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,10 +47,15 @@ impl TpuManager {
|
||||||
}
|
}
|
||||||
let transaction = bincode::serialize(transaction).unwrap();
|
let transaction = bincode::serialize(transaction).unwrap();
|
||||||
|
|
||||||
self.transaction_service
|
let res = self.transaction_service
|
||||||
.send_transaction(transaction, None)
|
.send_transaction(transaction, None)
|
||||||
.await
|
.await;
|
||||||
.is_ok()
|
|
||||||
|
if let Err(e) = &res{
|
||||||
|
print!("error sending txs on custom tpu {e:?}");
|
||||||
|
}
|
||||||
|
res.is_ok()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn send_transaction_batch(
|
pub async fn send_transaction_batch(
|
||||||
|
|
Loading…
Reference in New Issue