Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Commit 20fc3a5

Browse files
author
steviez
authored
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.
1 parent 5edd032 commit 20fc3a5

File tree

8 files changed

+12
-14
lines changed

8 files changed

+12
-14
lines changed

core/src/cache_block_meta_service.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl CacheBlockMetaService {
5757
Self { thread_hdl }
5858
}
5959

60-
fn cache_block_meta(bank: Arc<Bank>, blockstore: &Arc<Blockstore>) {
60+
fn cache_block_meta(bank: Arc<Bank>, blockstore: &Blockstore) {
6161
if let Err(e) = blockstore.cache_block_time(bank.slot(), bank.clock().unix_timestamp) {
6262
error!("cache_block_time failed: slot {:?} {:?}", bank.slot(), e);
6363
}

core/src/ledger_cleanup_service.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ impl LedgerCleanupService {
9595
/// - `total_shreds` (u64): the total estimated number of shreds before the
9696
/// `root`.
9797
fn find_slots_to_clean(
98-
blockstore: &Arc<Blockstore>,
98+
blockstore: &Blockstore,
9999
root: Slot,
100100
max_ledger_shreds: u64,
101101
) -> (bool, Slot, u64) {

core/src/replay_stage.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2091,7 +2091,7 @@ impl ReplayStage {
20912091
vote_account_pubkey: &Pubkey,
20922092
identity_keypair: &Keypair,
20932093
authorized_voter_keypairs: &[Arc<Keypair>],
2094-
blockstore: &Arc<Blockstore>,
2094+
blockstore: &Blockstore,
20952095
leader_schedule_cache: &Arc<LeaderScheduleCache>,
20962096
lockouts_sender: &Sender<CommitmentAggregationData>,
20972097
accounts_background_request_sender: &AbsRequestSender,

core/src/rewards_recorder_service.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ impl RewardsRecorderService {
5353
fn write_rewards(
5454
rewards_receiver: &RewardsRecorderReceiver,
5555
max_complete_rewards_slot: &Arc<AtomicU64>,
56-
blockstore: &Arc<Blockstore>,
56+
blockstore: &Blockstore,
5757
) -> Result<(), RecvTimeoutError> {
5858
match rewards_receiver.recv_timeout(Duration::from_secs(1))? {
5959
RewardsMessage::Batch((slot, rewards)) => {

core/src/sample_performance_service.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@ pub struct SamplePerformanceService {
2121
impl SamplePerformanceService {
2222
pub fn new(
2323
bank_forks: &Arc<RwLock<BankForks>>,
24-
blockstore: &Arc<Blockstore>,
24+
blockstore: Arc<Blockstore>,
2525
exit: Arc<AtomicBool>,
2626
) -> Self {
27-
let blockstore = blockstore.clone();
2827
let bank_forks = bank_forks.clone();
2928

3029
info!("Starting SamplePerformance service");

core/src/tpu.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ impl Tpu {
8989
subscriptions: &Arc<RpcSubscriptions>,
9090
transaction_status_sender: Option<TransactionStatusSender>,
9191
entry_notification_sender: Option<EntryNotifierSender>,
92-
blockstore: &Arc<Blockstore>,
92+
blockstore: Arc<Blockstore>,
9393
broadcast_type: &BroadcastStageType,
9494
exit: Arc<AtomicBool>,
9595
shred_version: u16,
@@ -254,7 +254,7 @@ impl Tpu {
254254
entry_receiver,
255255
retransmit_slots_receiver,
256256
exit,
257-
blockstore.clone(),
257+
blockstore,
258258
bank_forks,
259259
shred_version,
260260
turbine_quic_endpoint_sender,

core/src/validator.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -390,12 +390,11 @@ struct BlockstoreRootScan {
390390
}
391391

392392
impl BlockstoreRootScan {
393-
fn new(config: &ValidatorConfig, blockstore: &Arc<Blockstore>, exit: Arc<AtomicBool>) -> Self {
393+
fn new(config: &ValidatorConfig, blockstore: Arc<Blockstore>, exit: Arc<AtomicBool>) -> Self {
394394
let thread = if config.rpc_addrs.is_some()
395395
&& config.rpc_config.enable_rpc_transaction_history
396396
&& config.rpc_config.rpc_scan_and_fix_roots
397397
{
398-
let blockstore = blockstore.clone();
399398
Some(
400399
Builder::new()
401400
.name("solBStoreRtScan".to_string())
@@ -822,7 +821,7 @@ impl Validator {
822821
if config.rpc_addrs.is_some() && config.rpc_config.enable_rpc_transaction_history {
823822
Some(SamplePerformanceService::new(
824823
&bank_forks,
825-
&blockstore,
824+
blockstore.clone(),
826825
exit.clone(),
827826
))
828827
} else {
@@ -1222,7 +1221,7 @@ impl Validator {
12221221
&rpc_subscriptions,
12231222
transaction_status_sender,
12241223
entry_notification_sender,
1225-
&blockstore,
1224+
blockstore.clone(),
12261225
&config.broadcast_stage_type,
12271226
exit,
12281227
node.info.shred_version(),
@@ -1645,7 +1644,7 @@ fn load_blockstore(
16451644
let original_blockstore_root = blockstore.last_root();
16461645

16471646
let blockstore = Arc::new(blockstore);
1648-
let blockstore_root_scan = BlockstoreRootScan::new(config, &blockstore, exit.clone());
1647+
let blockstore_root_scan = BlockstoreRootScan::new(config, blockstore.clone(), exit.clone());
16491648
let halt_at_slot = config
16501649
.halt_at_slot
16511650
.or_else(|| blockstore.highest_slot().unwrap_or(None));

rpc/src/transaction_status_service.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ impl TransactionStatusService {
6161
max_complete_transaction_status_slot: &Arc<AtomicU64>,
6262
enable_rpc_transaction_history: bool,
6363
transaction_notifier: Option<TransactionNotifierLock>,
64-
blockstore: &Arc<Blockstore>,
64+
blockstore: &Blockstore,
6565
enable_extended_tx_metadata_storage: bool,
6666
) -> Result<(), RecvTimeoutError> {
6767
match write_transaction_status_receiver.recv_timeout(Duration::from_secs(1))? {

0 commit comments

Comments
 (0)