Rpc: enable getConfirmedBlock and getConfirmedTransaction to return confirmed (not yet finalized) data (#16142)
* Add Blockstore block and tx apis that allow unrooted responses * Add TransactionStatusMessage, and send on bank freeze; also refactor TransactionStatusSender * Track highest slot with tx-status writes complete * Rename and unpub fn * Add commitment to GetConfirmed input configs * Support confirmed blocks in getConfirmedBlock * Support confirmed txs in getConfirmedTransaction * Update sigs-for-addr2 comment * Enable confirmed block in cli * Enable confirmed transaction in cli * Review comments * Rename blockstore method
This commit is contained in:
@ -70,7 +70,7 @@ use std::{
|
||||
net::SocketAddr,
|
||||
ops::Deref,
|
||||
path::{Path, PathBuf},
|
||||
sync::atomic::{AtomicBool, Ordering},
|
||||
sync::atomic::{AtomicBool, AtomicU64, Ordering},
|
||||
sync::mpsc::Receiver,
|
||||
sync::{Arc, Mutex, RwLock},
|
||||
thread::sleep,
|
||||
@ -249,6 +249,7 @@ impl fmt::Debug for ValidatorExit {
|
||||
struct TransactionHistoryServices {
|
||||
transaction_status_sender: Option<TransactionStatusSender>,
|
||||
transaction_status_service: Option<TransactionStatusService>,
|
||||
max_complete_transaction_status_slot: Arc<AtomicU64>,
|
||||
rewards_recorder_sender: Option<RewardsRecorderSender>,
|
||||
rewards_recorder_service: Option<RewardsRecorderService>,
|
||||
cache_block_time_sender: Option<CacheBlockTimeSender>,
|
||||
@ -384,6 +385,7 @@ impl Validator {
|
||||
TransactionHistoryServices {
|
||||
transaction_status_sender,
|
||||
transaction_status_service,
|
||||
max_complete_transaction_status_slot,
|
||||
rewards_recorder_sender,
|
||||
rewards_recorder_service,
|
||||
cache_block_time_sender,
|
||||
@ -545,6 +547,7 @@ impl Validator {
|
||||
config.send_transaction_leader_forward_count,
|
||||
max_slots.clone(),
|
||||
leader_schedule_cache.clone(),
|
||||
max_complete_transaction_status_slot,
|
||||
)),
|
||||
if config.rpc_config.minimal_api {
|
||||
None
|
||||
@ -1264,6 +1267,7 @@ fn initialize_rpc_transaction_history_services(
|
||||
exit: &Arc<AtomicBool>,
|
||||
enable_cpi_and_log_storage: bool,
|
||||
) -> TransactionHistoryServices {
|
||||
let max_complete_transaction_status_slot = Arc::new(AtomicU64::new(blockstore.max_root()));
|
||||
let (transaction_status_sender, transaction_status_receiver) = unbounded();
|
||||
let transaction_status_sender = Some(TransactionStatusSender {
|
||||
sender: transaction_status_sender,
|
||||
@ -1271,6 +1275,7 @@ fn initialize_rpc_transaction_history_services(
|
||||
});
|
||||
let transaction_status_service = Some(TransactionStatusService::new(
|
||||
transaction_status_receiver,
|
||||
max_complete_transaction_status_slot.clone(),
|
||||
blockstore.clone(),
|
||||
exit,
|
||||
));
|
||||
@ -1293,6 +1298,7 @@ fn initialize_rpc_transaction_history_services(
|
||||
TransactionHistoryServices {
|
||||
transaction_status_sender,
|
||||
transaction_status_service,
|
||||
max_complete_transaction_status_slot,
|
||||
rewards_recorder_sender,
|
||||
rewards_recorder_service,
|
||||
cache_block_time_sender,
|
||||
|
Reference in New Issue
Block a user