ledger-tool: Add flag to store tx metadata in verify subcommand (#32400)
This commit is contained in:
parent
70f8ced277
commit
74d54ccd7c
|
@ -19,16 +19,12 @@ use {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
solana_measure::measure,
|
solana_measure::measure,
|
||||||
solana_rpc::{
|
solana_rpc::transaction_status_service::TransactionStatusService,
|
||||||
transaction_notifier_interface::TransactionNotifierLock,
|
|
||||||
transaction_status_service::TransactionStatusService,
|
|
||||||
},
|
|
||||||
solana_runtime::{
|
solana_runtime::{
|
||||||
accounts_background_service::{
|
accounts_background_service::{
|
||||||
AbsRequestHandlers, AbsRequestSender, AccountsBackgroundService,
|
AbsRequestHandlers, AbsRequestSender, AccountsBackgroundService,
|
||||||
PrunedBanksRequestHandler, SnapshotRequestHandler,
|
PrunedBanksRequestHandler, SnapshotRequestHandler,
|
||||||
},
|
},
|
||||||
accounts_update_notifier_interface::AccountsUpdateNotifier,
|
|
||||||
bank_forks::BankForks,
|
bank_forks::BankForks,
|
||||||
hardened_unpack::open_genesis_config,
|
hardened_unpack::open_genesis_config,
|
||||||
snapshot_config::SnapshotConfig,
|
snapshot_config::SnapshotConfig,
|
||||||
|
@ -207,9 +203,8 @@ pub fn load_and_process_ledger(
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut accounts_update_notifier = Option::<AccountsUpdateNotifier>::default();
|
let geyser_plugin_active = arg_matches.is_present("geyser_plugin_config");
|
||||||
let mut transaction_notifier = Option::<TransactionNotifierLock>::default();
|
let (accounts_update_notifier, transaction_notifier) = if geyser_plugin_active {
|
||||||
if arg_matches.is_present("geyser_plugin_config") {
|
|
||||||
let geyser_config_files = values_t_or_exit!(arg_matches, "geyser_plugin_config", String)
|
let geyser_config_files = values_t_or_exit!(arg_matches, "geyser_plugin_config", String)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(PathBuf::from)
|
.map(PathBuf::from)
|
||||||
|
@ -224,9 +219,13 @@ pub fn load_and_process_ledger(
|
||||||
exit(1);
|
exit(1);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
accounts_update_notifier = geyser_service.get_accounts_update_notifier();
|
(
|
||||||
transaction_notifier = geyser_service.get_transaction_notifier();
|
geyser_service.get_accounts_update_notifier(),
|
||||||
}
|
geyser_service.get_transaction_notifier(),
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
(None, None)
|
||||||
|
};
|
||||||
|
|
||||||
let exit = Arc::new(AtomicBool::new(false));
|
let exit = Arc::new(AtomicBool::new(false));
|
||||||
let (bank_forks, leader_schedule_cache, starting_snapshot_hashes, ..) =
|
let (bank_forks, leader_schedule_cache, starting_snapshot_hashes, ..) =
|
||||||
|
@ -294,27 +293,41 @@ pub fn load_and_process_ledger(
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let (transaction_status_sender, transaction_status_service) = if transaction_notifier.is_some()
|
let enable_rpc_transaction_history = arg_matches.is_present("enable_rpc_transaction_history");
|
||||||
{
|
|
||||||
let (transaction_status_sender, transaction_status_receiver) = unbounded();
|
let (transaction_status_sender, transaction_status_service) =
|
||||||
let transaction_status_service = TransactionStatusService::new(
|
if geyser_plugin_active || enable_rpc_transaction_history {
|
||||||
transaction_status_receiver,
|
// Need Primary (R/W) access to insert transaction data
|
||||||
Arc::default(),
|
let tss_blockstore = if enable_rpc_transaction_history {
|
||||||
false,
|
Arc::new(open_blockstore(
|
||||||
transaction_notifier,
|
blockstore.ledger_path(),
|
||||||
blockstore.clone(),
|
AccessType::PrimaryForMaintenance,
|
||||||
false,
|
None,
|
||||||
exit.clone(),
|
false,
|
||||||
);
|
))
|
||||||
(
|
} else {
|
||||||
Some(TransactionStatusSender {
|
blockstore.clone()
|
||||||
sender: transaction_status_sender,
|
};
|
||||||
}),
|
|
||||||
Some(transaction_status_service),
|
let (transaction_status_sender, transaction_status_receiver) = unbounded();
|
||||||
)
|
let transaction_status_service = TransactionStatusService::new(
|
||||||
} else {
|
transaction_status_receiver,
|
||||||
(None, None)
|
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(
|
let result = blockstore_processor::process_blockstore_from_root(
|
||||||
blockstore.as_ref(),
|
blockstore.as_ref(),
|
||||||
|
|
|
@ -1620,6 +1620,12 @@ fn main() {
|
||||||
.takes_value(false)
|
.takes_value(false)
|
||||||
.help("Skip ledger PoH and transaction verification."),
|
.help("Skip ledger PoH and transaction verification."),
|
||||||
)
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("enable_rpc_transaction_history")
|
||||||
|
.long("enable-rpc-transaction-history")
|
||||||
|
.takes_value(false)
|
||||||
|
.help("Store transaction info for processed slots into local ledger"),
|
||||||
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("run_final_hash_calc")
|
Arg::with_name("run_final_hash_calc")
|
||||||
.long("run-final-accounts-hash-calculation")
|
.long("run-final-accounts-hash-calculation")
|
||||||
|
|
Loading…
Reference in New Issue