Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ledger-tool: Adjust logic to obtain TransactionStatusService Blockstore #34646

Merged
merged 2 commits into from
Jan 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 32 additions & 30 deletions ledger-tool/src/ledger_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,39 +356,41 @@ pub fn load_and_process_ledger(

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
let tss_blockstore = if enable_rpc_transaction_history {
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,
false,
exit.clone(),
);
(
Some(TransactionStatusSender {
sender: transaction_status_sender,
}),
Some(transaction_status_service),
)
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() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only logic change was the addition of && !blockstore.is_primary_access() to this line (first commit). It is unintuitive to me that this change would make the linter want to adjust lines for the if statement that encloses this line (and other stuff), but that is what cargo fmt wanted so 🤷

Arc::new(open_blockstore(
blockstore.ledger_path(),
arg_matches,
AccessType::PrimaryForMaintenance,
))
} else {
(None, None)
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,
false,
exit.clone(),
);
(
Some(TransactionStatusSender {
sender: transaction_status_sender,
}),
Some(transaction_status_service),
)
} else {
(None, None)
};

let result = blockstore_processor::process_blockstore_from_root(
blockstore.as_ref(),
&bank_forks,
Expand Down