From dee4acc248b014ad770d4cb62ebd9cf253b385ff Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Mon, 2 Dec 2024 23:36:35 +0900 Subject: [PATCH] Make unified-scheduler use transaction_status_sender in ledger-tool (#3861) Use transaction_status_sender if available --- ledger-tool/src/ledger_utils.rs | 78 ++++++++++++++++----------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/ledger-tool/src/ledger_utils.rs b/ledger-tool/src/ledger_utils.rs index 0d58d8d91b883f..10230660f4cfa9 100644 --- a/ledger-tool/src/ledger_utils.rs +++ b/ledger-tool/src/ledger_utils.rs @@ -283,6 +283,44 @@ pub fn load_and_process_ledger( }; let exit = Arc::new(AtomicBool::new(false)); + + let enable_rpc_transaction_history = arg_matches.is_present("enable_rpc_transaction_history"); + + let (transaction_status_sender, transaction_status_service) = if geyser_plugin_active + || enable_rpc_transaction_history + { + // Need Primary (R/W) access to insert transaction data; + // obtain Primary access if we do not already have it + let tss_blockstore = if enable_rpc_transaction_history && !blockstore.is_primary_access() { + Arc::new(open_blockstore( + blockstore.ledger_path(), + arg_matches, + AccessType::PrimaryForMaintenance, + )) + } else { + blockstore.clone() + }; + + let (transaction_status_sender, transaction_status_receiver) = unbounded(); + let transaction_status_service = TransactionStatusService::new( + transaction_status_receiver, + Arc::default(), + enable_rpc_transaction_history, + transaction_notifier, + tss_blockstore, + arg_matches.is_present("enable_extended_tx_metadata_storage"), + exit.clone(), + ); + ( + Some(TransactionStatusSender { + sender: transaction_status_sender, + }), + Some(transaction_status_service), + ) + } else { + (transaction_status_sender, None) + }; + let (bank_forks, leader_schedule_cache, starting_snapshot_hashes, ..) = bank_forks_utils::load_bank_forks( genesis_config, @@ -319,7 +357,6 @@ pub fn load_and_process_ledger( } } BlockVerificationMethod::UnifiedScheduler => { - let no_transaction_status_sender = None; let no_replay_vote_sender = None; let ignored_prioritization_fee_cache = Arc::new(PrioritizationFeeCache::new(0u64)); bank_forks @@ -328,7 +365,7 @@ pub fn load_and_process_ledger( .install_scheduler_pool(DefaultSchedulerPool::new_dyn( unified_scheduler_handler_threads, process_options.runtime_config.log_messages_bytes_limit, - no_transaction_status_sender, + transaction_status_sender.clone(), no_replay_vote_sender, ignored_prioritization_fee_cache, )); @@ -368,43 +405,6 @@ pub fn load_and_process_ledger( process_options.accounts_db_test_hash_calculation, ); - let enable_rpc_transaction_history = arg_matches.is_present("enable_rpc_transaction_history"); - - let (transaction_status_sender, transaction_status_service) = if geyser_plugin_active - || enable_rpc_transaction_history - { - // Need Primary (R/W) access to insert transaction data; - // obtain Primary access if we do not already have it - let tss_blockstore = if enable_rpc_transaction_history && !blockstore.is_primary_access() { - Arc::new(open_blockstore( - blockstore.ledger_path(), - arg_matches, - AccessType::PrimaryForMaintenance, - )) - } else { - blockstore.clone() - }; - - let (transaction_status_sender, transaction_status_receiver) = unbounded(); - let transaction_status_service = TransactionStatusService::new( - transaction_status_receiver, - Arc::default(), - enable_rpc_transaction_history, - transaction_notifier, - tss_blockstore, - arg_matches.is_present("enable_extended_tx_metadata_storage"), - exit.clone(), - ); - ( - Some(TransactionStatusSender { - sender: transaction_status_sender, - }), - Some(transaction_status_service), - ) - } else { - (transaction_status_sender, None) - }; - let result = blockstore_processor::process_blockstore_from_root( blockstore.as_ref(), &bank_forks,