Skip to content

Commit d80aceb

Browse files
committed
Fix or replace various unwraps
1 parent 025bf9b commit d80aceb

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
@@ -526,7 +526,8 @@ where
526526
}
527527
LdkEvent::SpendableOutputs { outputs } => {
528528
// TODO: We should eventually remember the outputs and supply them to the wallet's coin selection, once BDK allows us to do so.
529-
let destination_address = self.wallet.get_new_address().unwrap();
529+
let destination_address =
530+
self.wallet.get_new_address().expect("Failed to get destination address");
530531
let output_descriptors = &outputs.iter().collect::<Vec<_>>();
531532
let tx_feerate =
532533
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
@@ -1086,7 +1086,9 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
10861086
///
10871087
/// **Note:** This **MUST** be called after each event has been handled.
10881088
pub fn event_handled(&self) {
1089-
self.event_queue.event_handled().unwrap();
1089+
self.event_queue
1090+
.event_handled()
1091+
.expect("Couldn't mark event handled due to persistence failure");
10901092
}
10911093

10921094
/// Returns our own node id

src/logger.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub(crate) struct FilesystemLogger {
1717
impl FilesystemLogger {
1818
pub(crate) fn new(file_path: String, level: Level) -> Self {
1919
if let Some(parent_dir) = Path::new(&file_path).parent() {
20-
fs::create_dir_all(parent_dir).unwrap();
20+
fs::create_dir_all(parent_dir).expect("Failed to create log parent directory");
2121
}
2222
Self { file_path, level }
2323
}
@@ -40,8 +40,8 @@ impl Logger for FilesystemLogger {
4040
.create(true)
4141
.append(true)
4242
.open(self.file_path.clone())
43-
.unwrap()
43+
.expect("Failed to open log file")
4444
.write_all(log.as_bytes())
45-
.unwrap();
45+
.expect("Failed to write to log file")
4646
}
4747
}

0 commit comments

Comments
 (0)