Merge pull request #84 from blockworks-foundation/solving_diff_finalized_confirmed

solving the issue for difference between finalized and confirmed, add…
This commit is contained in:
galactus 2023-03-09 15:15:13 +01:00 committed by GitHub
commit 1fc73e0b5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 6 deletions

View File

@ -20,4 +20,4 @@ FROM debian:bullseye-slim as run
RUN apt-get update && apt-get -y install ca-certificates libc6
COPY --from=build /app/target/release/lite-rpc /usr/local/bin/
CMD lite-rpc --rpc-addr "$RPC_URL" --ws-addr "$WS_URL"
CMD lite-rpc --rpc-addr "$RPC_URL" --ws-addr "$WS_URL" -p

View File

@ -22,7 +22,7 @@ pub const DEFAULT_TX_MAX_RETRIES: u16 = 1;
#[from_env]
pub const DEFAULT_TX_BATCH_SIZE: usize = 128;
#[from_env]
pub const DEFAULT_FANOUT_SIZE: u64 = 32;
pub const DEFAULT_FANOUT_SIZE: u64 = 12;
#[from_env]
pub const DEFAULT_TX_BATCH_INTERVAL_MS: u64 = 1;
#[from_env]

View File

@ -7,7 +7,10 @@ use anyhow::bail;
use dashmap::DashMap;
use log::{info, warn};
use prometheus::{core::GenericGauge, opts, register_int_counter, register_int_gauge, IntCounter};
use prometheus::{
core::GenericGauge, histogram_opts, opts, register_histogram, register_int_counter,
register_int_gauge, Histogram, IntCounter,
};
use solana_transaction_status::TransactionStatus;
use tokio::{sync::mpsc::UnboundedReceiver, task::JoinHandle};
@ -25,6 +28,11 @@ lazy_static::lazy_static! {
static ref TXS_SENT_ERRORS: IntCounter =
register_int_counter!("literpc_txs_sent_errors", "Number of errors while transactions forwarded to tpu").unwrap();
static ref TX_BATCH_SIZES: GenericGauge<prometheus::core::AtomicI64> = register_int_gauge!(opts!("literpc_tx_batch_size", "batchsize of tx sent by literpc")).unwrap();
static ref TT_SENT_TIMER: Histogram = register_histogram!(histogram_opts!(
"literpc_txs_send_timer",
"Time to send transaction batch",
))
.unwrap();
}
pub type WireTransaction = Vec<u8>;
@ -75,14 +83,17 @@ impl TxSender {
return;
}
let timer = TT_SENT_TIMER.start_timer();
let tpu_client = self.tpu_manager.clone();
let txs_sent = self.txs_sent_store.clone();
for (sig, _) in &sigs_and_slots {
txs_sent.insert(sig.to_owned(), TxProps::default());
}
let quic_response = match tpu_client.try_send_wire_transaction_batch(txs).await {
Ok(_) => {
for (sig, _) in &sigs_and_slots {
txs_sent.insert(sig.to_owned(), TxProps::default());
}
// metrics
TXS_SENT.inc_by(sigs_and_slots.len() as u64);
@ -113,6 +124,8 @@ impl TxSender {
.expect("Error writing to postgres service");
}
}
timer.observe_duration();
}
/// retry and confirm transactions every 2ms (avg time to confirm tx)