Skip to content

Commit

Permalink
Replace several .expect() statements with error handling (solana-labs…
Browse files Browse the repository at this point in the history
  • Loading branch information
steviez authored Oct 24, 2023
1 parent 612e8e8 commit 9ffbe2a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions core/src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,7 @@ impl Validator {
&identity_keypair,
node.info
.tpu(Protocol::UDP)
.expect("Operator must spin up node with valid TPU address")
.map_err(|err| format!("Invalid TPU address: {err:?}"))?
.ip(),
)),
Some((&staked_nodes, &identity_keypair.pubkey())),
Expand Down Expand Up @@ -1181,7 +1181,7 @@ impl Validator {
node.sockets.tvu_quic,
node.info
.tvu(Protocol::QUIC)
.expect("Operator must spin up node with valid QUIC TVU address")
.map_err(|err| format!("Invalid QUIC TVU address: {err:?}"))?
.ip(),
turbine_quic_endpoint_sender,
bank_forks.clone(),
Expand All @@ -1206,7 +1206,7 @@ impl Validator {
node.sockets.serve_repair_quic,
node.info
.serve_repair(Protocol::QUIC)
.expect("Operator must spin up node with valid QUIC serve-repair address")
.map_err(|err| format!("Invalid QUIC serve-repair address: {err:?}"))?
.ip(),
repair_quic_endpoint_sender,
bank_forks.clone(),
Expand Down Expand Up @@ -1741,7 +1741,8 @@ fn load_blockstore(
completed_slots_receiver,
..
} = Blockstore::open_with_signal(ledger_path, blockstore_options_from_config(config))
.expect("Failed to open ledger database");
.map_err(|err| format!("Failed to open Blockstore: {err:?}"))?;

blockstore.shred_timing_point_sender = poh_timing_point_sender;
// following boot sequence (esp BankForks) could set root. so stash the original value
// of blockstore root away here as soon as possible.
Expand Down

0 comments on commit 9ffbe2a

Please sign in to comment.