comment tpu_service input

This commit is contained in:
GroovieGermanikus 2023-06-27 13:35:21 +02:00
parent a786e190bd
commit eb25711496
2 changed files with 17 additions and 3 deletions

View File

@ -4,7 +4,9 @@ use anyhow::Context;
use bincode::DefaultOptions;
use log::info;
use serde::Serialize;
use solana_sdk::hash::{Hash, Hasher};
use solana_sdk::pubkey::Pubkey;
use solana_sdk::signature::{Keypair, Signer};
use solana_sdk::transaction::{Transaction, VersionedTransaction};
use spl_memo::solana_program::message::VersionedMessage;
use solana_lite_rpc_core::proxy_request_format::TpuForwardingRequest;
@ -13,10 +15,10 @@ use solana_lite_rpc_core::proxy_request_format::*;
#[test]
fn roundtrip() {
let payer_pubkey = Pubkey::new_unique();
let signer_pubkey = Pubkey::new_unique();
let payer = Keypair::from_base58_string("rKiJ7H5UUp3JR18kNyTF1XPuwPKHEM7gMLWHZPWP5djrW1vSjfwjhvJrevxF9MPmUmN9gJMLHZdLMgc9ao78eKr");
let payer_pubkey = payer.pubkey();
let memo_ix = spl_memo::build_memo("Hello world".as_bytes(), &[&signer_pubkey]);
let memo_ix = spl_memo::build_memo("Hello world".as_bytes(), &[&payer_pubkey]);
let tx = Transaction::new_with_payer(&[memo_ix], Some(&payer_pubkey));

View File

@ -46,18 +46,30 @@ lazy_static::lazy_static! {
register_int_gauge!(opts!("literpc_estimated_slot", "Estimated slot seen by last rpc")).unwrap();
}
/// service (singleton)
#[derive(Clone)]
pub struct TpuService {
/// out
current_slot: Arc<AtomicU64>,
/// out
estimated_slot: Arc<AtomicU64>,
/// in
fanout_slots: u64,
/// in
rpc_client: Arc<RpcClient>,
/// in
rpc_ws_address: String,
/// in
broadcast_sender: Arc<tokio::sync::broadcast::Sender<(String, Vec<u8>)>>,
/// in
tpu_connection_manager: Arc<TpuConnectionManager>,
/// in
identity: Arc<Keypair>,
/// out
identity_stakes: Arc<RwLock<IdentityStakes>>,
/// in
txs_sent_store: TxStore,
/// out
leader_schedule: Arc<LeaderSchedule>,
}