Skip to content

Commit c69a9ac

Browse files
mergify[bot]ryoqun
andauthored
v2.1: Make unified-scheduler use transaction_status_sender in ledger-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]>
1 parent a6c2a78 commit c69a9ac

File tree

1 file changed

+39
-39
lines changed

1 file changed

+39
-39
lines changed

ledger-tool/src/ledger_utils.rs

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,44 @@ pub fn load_and_process_ledger(
284284
};
285285

286286
let exit = Arc::new(AtomicBool::new(false));
287+
288+
let enable_rpc_transaction_history = arg_matches.is_present("enable_rpc_transaction_history");
289+
290+
let (transaction_status_sender, transaction_status_service) = if geyser_plugin_active
291+
|| enable_rpc_transaction_history
292+
{
293+
// Need Primary (R/W) access to insert transaction data;
294+
// obtain Primary access if we do not already have it
295+
let tss_blockstore = if enable_rpc_transaction_history && !blockstore.is_primary_access() {
296+
Arc::new(open_blockstore(
297+
blockstore.ledger_path(),
298+
arg_matches,
299+
AccessType::PrimaryForMaintenance,
300+
))
301+
} else {
302+
blockstore.clone()
303+
};
304+
305+
let (transaction_status_sender, transaction_status_receiver) = unbounded();
306+
let transaction_status_service = TransactionStatusService::new(
307+
transaction_status_receiver,
308+
Arc::default(),
309+
enable_rpc_transaction_history,
310+
transaction_notifier,
311+
tss_blockstore,
312+
arg_matches.is_present("enable_extended_tx_metadata_storage"),
313+
exit.clone(),
314+
);
315+
(
316+
Some(TransactionStatusSender {
317+
sender: transaction_status_sender,
318+
}),
319+
Some(transaction_status_service),
320+
)
321+
} else {
322+
(transaction_status_sender, None)
323+
};
324+
287325
let (bank_forks, leader_schedule_cache, starting_snapshot_hashes, ..) =
288326
bank_forks_utils::load_bank_forks(
289327
genesis_config,
@@ -320,7 +358,6 @@ pub fn load_and_process_ledger(
320358
}
321359
}
322360
BlockVerificationMethod::UnifiedScheduler => {
323-
let no_transaction_status_sender = None;
324361
let no_replay_vote_sender = None;
325362
let ignored_prioritization_fee_cache = Arc::new(PrioritizationFeeCache::new(0u64));
326363
bank_forks
@@ -329,7 +366,7 @@ pub fn load_and_process_ledger(
329366
.install_scheduler_pool(DefaultSchedulerPool::new_dyn(
330367
unified_scheduler_handler_threads,
331368
process_options.runtime_config.log_messages_bytes_limit,
332-
no_transaction_status_sender,
369+
transaction_status_sender.clone(),
333370
no_replay_vote_sender,
334371
ignored_prioritization_fee_cache,
335372
));
@@ -369,43 +406,6 @@ pub fn load_and_process_ledger(
369406
process_options.accounts_db_test_hash_calculation,
370407
);
371408

372-
let enable_rpc_transaction_history = arg_matches.is_present("enable_rpc_transaction_history");
373-
374-
let (transaction_status_sender, transaction_status_service) = if geyser_plugin_active
375-
|| enable_rpc_transaction_history
376-
{
377-
// Need Primary (R/W) access to insert transaction data;
378-
// obtain Primary access if we do not already have it
379-
let tss_blockstore = if enable_rpc_transaction_history && !blockstore.is_primary_access() {
380-
Arc::new(open_blockstore(
381-
blockstore.ledger_path(),
382-
arg_matches,
383-
AccessType::PrimaryForMaintenance,
384-
))
385-
} else {
386-
blockstore.clone()
387-
};
388-
389-
let (transaction_status_sender, transaction_status_receiver) = unbounded();
390-
let transaction_status_service = TransactionStatusService::new(
391-
transaction_status_receiver,
392-
Arc::default(),
393-
enable_rpc_transaction_history,
394-
transaction_notifier,
395-
tss_blockstore,
396-
arg_matches.is_present("enable_extended_tx_metadata_storage"),
397-
exit.clone(),
398-
);
399-
(
400-
Some(TransactionStatusSender {
401-
sender: transaction_status_sender,
402-
}),
403-
Some(transaction_status_service),
404-
)
405-
} else {
406-
(transaction_status_sender, None)
407-
};
408-
409409
let result = blockstore_processor::process_blockstore_from_root(
410410
blockstore.as_ref(),
411411
&bank_forks,

0 commit comments

Comments
 (0)