Skip to content

Commit 2bf309d

Browse files
committed
f: error bubble up
1 parent d1d63fc commit 2bf309d

File tree

1 file changed

+11
-20
lines changed

1 file changed

+11
-20
lines changed

lightning/src/util/sweep.rs

+11-20
Original file line numberDiff line numberDiff line change
@@ -518,9 +518,7 @@ where
518518

519519
// Sweep the outputs.
520520
{
521-
let mut runtime_sweeper_state = self.sweeper_state.lock().unwrap();
522-
523-
let sweeper_state = &mut runtime_sweeper_state;
521+
let mut sweeper_state = self.sweeper_state.lock().unwrap();
524522

525523
let change_destination_script = change_destination_script_result?;
526524

@@ -539,24 +537,17 @@ where
539537
return Ok(());
540538
}
541539

542-
let spending_tx = match self.spend_outputs(
543-
sweeper_state,
544-
&respend_descriptors,
545-
change_destination_script,
546-
) {
547-
Ok(spending_tx) => {
548-
log_debug!(
549-
self.logger,
550-
"Generating and broadcasting sweeping transaction {}",
551-
spending_tx.compute_txid()
552-
);
553-
spending_tx
554-
},
555-
Err(e) => {
540+
let spending_tx = self
541+
.spend_outputs(&sweeper_state, &respend_descriptors, change_destination_script)
542+
.map_err(|e| {
556543
log_error!(self.logger, "Error spending outputs: {:?}", e);
557-
return Ok(());
558-
},
559-
};
544+
})?;
545+
546+
log_debug!(
547+
self.logger,
548+
"Generating and broadcasting sweeping transaction {}",
549+
spending_tx.compute_txid()
550+
);
560551

561552
// As we didn't modify the state so far, the same filter_fn yields the same elements as
562553
// above.

0 commit comments

Comments
 (0)