Skip to content

Commit 36f9834

Browse files
committed
f Skip any unconfirmations if unconf_height is None
1 parent ca643a2 commit 36f9834

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

lightning/src/util/sweep.rs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -662,18 +662,14 @@ where
662662
.find(|o| o.status.latest_spending_tx().map(|tx| tx.txid()) == Some(*txid))
663663
.and_then(|o| o.status.confirmation_height());
664664

665-
// Unconfirm all >= this height.
666-
let mut should_persist = false;
667-
state_lock
668-
.outputs
669-
.iter_mut()
670-
.filter(|o| o.status.confirmation_height() >= unconf_height)
671-
.for_each(|o| {
672-
should_persist = true;
673-
o.status.unconfirmed()
674-
});
665+
if let Some(unconf_height) = unconf_height {
666+
// Unconfirm all >= this height.
667+
state_lock
668+
.outputs
669+
.iter_mut()
670+
.filter(|o| o.status.confirmation_height() >= Some(unconf_height))
671+
.for_each(|o| o.status.unconfirmed());
675672

676-
if should_persist {
677673
self.persist_state(&*state_lock).unwrap_or_else(|e| {
678674
log_error!(self.logger, "Error persisting OutputSweeper: {:?}", e);
679675
});

0 commit comments

Comments
 (0)