Skip to content

Commit

Permalink
v2.1: Make unified-scheduler use transaction_status_sender in ledger-…
Browse files Browse the repository at this point in the history
…tool (backport of #3861) (#3863)

Make unified-scheduler use transaction_status_sender in ledger-tool (#3861)

Use transaction_status_sender if available

(cherry picked from commit dee4acc)

Co-authored-by: Ryo Onodera <[email protected]>
  • Loading branch information
mergify[bot] and ryoqun authored Dec 4, 2024
1 parent a6c2a78 commit c69a9ac
Showing 1 changed file with 39 additions and 39 deletions.
78 changes: 39 additions & 39 deletions ledger-tool/src/ledger_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,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,
Expand Down Expand Up @@ -320,7 +358,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
Expand All @@ -329,7 +366,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,
));
Expand Down Expand Up @@ -369,43 +406,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,
Expand Down

0 comments on commit c69a9ac

Please sign in to comment.