Skip to content

Commit

Permalink
Handle JsonRpcService startup failure (solana-labs#27075)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbiseda authored Aug 12, 2022
1 parent 6c58acf commit e50013a
Show file tree
Hide file tree
Showing 7 changed files with 223 additions and 202 deletions.
8 changes: 4 additions & 4 deletions core/src/replay_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -397,9 +397,9 @@ impl ReplayStage {
drop_bank_sender: Sender<Vec<Arc<Bank>>>,
block_metadata_notifier: Option<BlockMetadataNotifierLock>,
log_messages_bytes_limit: Option<usize>,
) -> Self {
) -> Result<Self, String> {
let mut tower = if let Some(process_blockstore) = maybe_process_blockstore {
let tower = process_blockstore.process_to_create_tower();
let tower = process_blockstore.process_to_create_tower()?;
info!("Tower state: {:?}", tower);
tower
} else {
Expand Down Expand Up @@ -940,10 +940,10 @@ impl ReplayStage {
})
.unwrap();

Self {
Ok(Self {
t_replay,
commitment_service,
}
})
}

fn check_for_vote_only_mode(
Expand Down
11 changes: 6 additions & 5 deletions core/src/tvu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ impl Tvu {
accounts_background_request_sender: AbsRequestSender,
log_messages_bytes_limit: Option<usize>,
connection_cache: &Arc<ConnectionCache>,
) -> Self {
) -> Result<Self, String> {
let TvuSockets {
repair: repair_socket,
fetch: fetch_sockets,
Expand Down Expand Up @@ -288,7 +288,7 @@ impl Tvu {
drop_bank_sender,
block_metadata_notifier,
log_messages_bytes_limit,
);
)?;

let ledger_cleanup_service = tvu_config.max_ledger_shreds.map(|max_ledger_shreds| {
LedgerCleanupService::new(
Expand All @@ -301,7 +301,7 @@ impl Tvu {
)
});

Tvu {
Ok(Tvu {
fetch_stage,
shred_sigverify,
retransmit_stage,
Expand All @@ -313,7 +313,7 @@ impl Tvu {
voting_service,
warm_quic_cache_service,
drop_bank_service,
}
})
}

pub fn join(self) -> thread::Result<()> {
Expand Down Expand Up @@ -450,7 +450,8 @@ pub mod tests {
AbsRequestSender::default(),
None,
&Arc::new(ConnectionCache::default()),
);
)
.expect("assume success");
exit.store(true, Ordering::Relaxed);
tvu.join().unwrap();
poh_service.join().unwrap();
Expand Down
Loading

0 comments on commit e50013a

Please sign in to comment.