Skip to content

Commit b022172

Browse files
committed
Fix or replace various unwraps
1 parent 61d63a3 commit b022172

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

src/event.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,8 @@ where
553553
}
554554
LdkEvent::SpendableOutputs { outputs } => {
555555
// TODO: We should eventually remember the outputs and supply them to the wallet's coin selection, once BDK allows us to do so.
556-
let destination_address = self.wallet.get_new_address().unwrap();
556+
let destination_address =
557+
self.wallet.get_new_address().expect("Failed to get destination address");
557558
let output_descriptors = &outputs.iter().collect::<Vec<_>>();
558559
let tx_feerate =
559560
self.wallet.get_est_sat_per_1000_weight(ConfirmationTarget::Normal);

src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1062,7 +1062,9 @@ impl Node {
10621062
///
10631063
/// **Note:** This **MUST** be called after each event has been handled.
10641064
pub fn event_handled(&self) {
1065-
self.event_queue.event_handled().unwrap();
1065+
self.event_queue
1066+
.event_handled()
1067+
.expect("Couldn't mark event handled due to persistence failure");
10661068
}
10671069

10681070
/// Returns our own node id

src/logger.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub(crate) struct FilesystemLogger {
1515
impl FilesystemLogger {
1616
pub(crate) fn new(file_path: String) -> Self {
1717
if let Some(parent_dir) = Path::new(&file_path).parent() {
18-
fs::create_dir_all(parent_dir).unwrap();
18+
fs::create_dir_all(parent_dir).expect("Failed to create log parent directory");
1919
}
2020
Self { file_path }
2121
}
@@ -35,8 +35,8 @@ impl Logger for FilesystemLogger {
3535
.create(true)
3636
.append(true)
3737
.open(self.file_path.clone())
38-
.unwrap()
38+
.expect("Failed to open log file")
3939
.write_all(log.as_bytes())
40-
.unwrap();
40+
.expect("Failed to write to log file")
4141
}
4242
}

0 commit comments

Comments
 (0)