Remove improper &Arc<Blockstore> instances (#32698)
Update to either &Blockstore if the function just needs a ref, or Arc<Blockstore> if the function needs to hang onto a copy.
This commit is contained in:
parent
5edd032c79
commit
20fc3a5ded
|
@ -57,7 +57,7 @@ impl CacheBlockMetaService {
|
|||
Self { thread_hdl }
|
||||
}
|
||||
|
||||
fn cache_block_meta(bank: Arc<Bank>, blockstore: &Arc<Blockstore>) {
|
||||
fn cache_block_meta(bank: Arc<Bank>, blockstore: &Blockstore) {
|
||||
if let Err(e) = blockstore.cache_block_time(bank.slot(), bank.clock().unix_timestamp) {
|
||||
error!("cache_block_time failed: slot {:?} {:?}", bank.slot(), e);
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ impl LedgerCleanupService {
|
|||
/// - `total_shreds` (u64): the total estimated number of shreds before the
|
||||
/// `root`.
|
||||
fn find_slots_to_clean(
|
||||
blockstore: &Arc<Blockstore>,
|
||||
blockstore: &Blockstore,
|
||||
root: Slot,
|
||||
max_ledger_shreds: u64,
|
||||
) -> (bool, Slot, u64) {
|
||||
|
|
|
@ -2091,7 +2091,7 @@ impl ReplayStage {
|
|||
vote_account_pubkey: &Pubkey,
|
||||
identity_keypair: &Keypair,
|
||||
authorized_voter_keypairs: &[Arc<Keypair>],
|
||||
blockstore: &Arc<Blockstore>,
|
||||
blockstore: &Blockstore,
|
||||
leader_schedule_cache: &Arc<LeaderScheduleCache>,
|
||||
lockouts_sender: &Sender<CommitmentAggregationData>,
|
||||
accounts_background_request_sender: &AbsRequestSender,
|
||||
|
|
|
@ -53,7 +53,7 @@ impl RewardsRecorderService {
|
|||
fn write_rewards(
|
||||
rewards_receiver: &RewardsRecorderReceiver,
|
||||
max_complete_rewards_slot: &Arc<AtomicU64>,
|
||||
blockstore: &Arc<Blockstore>,
|
||||
blockstore: &Blockstore,
|
||||
) -> Result<(), RecvTimeoutError> {
|
||||
match rewards_receiver.recv_timeout(Duration::from_secs(1))? {
|
||||
RewardsMessage::Batch((slot, rewards)) => {
|
||||
|
|
|
@ -21,10 +21,9 @@ pub struct SamplePerformanceService {
|
|||
impl SamplePerformanceService {
|
||||
pub fn new(
|
||||
bank_forks: &Arc<RwLock<BankForks>>,
|
||||
blockstore: &Arc<Blockstore>,
|
||||
blockstore: Arc<Blockstore>,
|
||||
exit: Arc<AtomicBool>,
|
||||
) -> Self {
|
||||
let blockstore = blockstore.clone();
|
||||
let bank_forks = bank_forks.clone();
|
||||
|
||||
info!("Starting SamplePerformance service");
|
||||
|
|
|
@ -89,7 +89,7 @@ impl Tpu {
|
|||
subscriptions: &Arc<RpcSubscriptions>,
|
||||
transaction_status_sender: Option<TransactionStatusSender>,
|
||||
entry_notification_sender: Option<EntryNotifierSender>,
|
||||
blockstore: &Arc<Blockstore>,
|
||||
blockstore: Arc<Blockstore>,
|
||||
broadcast_type: &BroadcastStageType,
|
||||
exit: Arc<AtomicBool>,
|
||||
shred_version: u16,
|
||||
|
@ -254,7 +254,7 @@ impl Tpu {
|
|||
entry_receiver,
|
||||
retransmit_slots_receiver,
|
||||
exit,
|
||||
blockstore.clone(),
|
||||
blockstore,
|
||||
bank_forks,
|
||||
shred_version,
|
||||
turbine_quic_endpoint_sender,
|
||||
|
|
|
@ -390,12 +390,11 @@ struct BlockstoreRootScan {
|
|||
}
|
||||
|
||||
impl BlockstoreRootScan {
|
||||
fn new(config: &ValidatorConfig, blockstore: &Arc<Blockstore>, exit: Arc<AtomicBool>) -> Self {
|
||||
fn new(config: &ValidatorConfig, blockstore: Arc<Blockstore>, exit: Arc<AtomicBool>) -> Self {
|
||||
let thread = if config.rpc_addrs.is_some()
|
||||
&& config.rpc_config.enable_rpc_transaction_history
|
||||
&& config.rpc_config.rpc_scan_and_fix_roots
|
||||
{
|
||||
let blockstore = blockstore.clone();
|
||||
Some(
|
||||
Builder::new()
|
||||
.name("solBStoreRtScan".to_string())
|
||||
|
@ -822,7 +821,7 @@ impl Validator {
|
|||
if config.rpc_addrs.is_some() && config.rpc_config.enable_rpc_transaction_history {
|
||||
Some(SamplePerformanceService::new(
|
||||
&bank_forks,
|
||||
&blockstore,
|
||||
blockstore.clone(),
|
||||
exit.clone(),
|
||||
))
|
||||
} else {
|
||||
|
@ -1222,7 +1221,7 @@ impl Validator {
|
|||
&rpc_subscriptions,
|
||||
transaction_status_sender,
|
||||
entry_notification_sender,
|
||||
&blockstore,
|
||||
blockstore.clone(),
|
||||
&config.broadcast_stage_type,
|
||||
exit,
|
||||
node.info.shred_version(),
|
||||
|
@ -1645,7 +1644,7 @@ fn load_blockstore(
|
|||
let original_blockstore_root = blockstore.last_root();
|
||||
|
||||
let blockstore = Arc::new(blockstore);
|
||||
let blockstore_root_scan = BlockstoreRootScan::new(config, &blockstore, exit.clone());
|
||||
let blockstore_root_scan = BlockstoreRootScan::new(config, blockstore.clone(), exit.clone());
|
||||
let halt_at_slot = config
|
||||
.halt_at_slot
|
||||
.or_else(|| blockstore.highest_slot().unwrap_or(None));
|
||||
|
|
|
@ -61,7 +61,7 @@ impl TransactionStatusService {
|
|||
max_complete_transaction_status_slot: &Arc<AtomicU64>,
|
||||
enable_rpc_transaction_history: bool,
|
||||
transaction_notifier: Option<TransactionNotifierLock>,
|
||||
blockstore: &Arc<Blockstore>,
|
||||
blockstore: &Blockstore,
|
||||
enable_extended_tx_metadata_storage: bool,
|
||||
) -> Result<(), RecvTimeoutError> {
|
||||
match write_transaction_status_receiver.recv_timeout(Duration::from_secs(1))? {
|
||||
|
|
Loading…
Reference in New Issue