Skip to content

Commit

Permalink
Make unified-scheduler use transaction_status_sender in ledger-tool (#…
Browse files Browse the repository at this point in the history
…3861)

Use transaction_status_sender if available
  • Loading branch information
ryoqun authored Dec 2, 2024
1 parent c11fe18 commit dee4acc
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 @@ -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,
Expand Down Expand Up @@ -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
Expand All @@ -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,
));
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit dee4acc

Please sign in to comment.