Skip to content

Commit bafcabd

Browse files
committed
fix: account for update_monitor side effect
1 parent cece84c commit bafcabd

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

lightning/src/chain/channelmonitor.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4474,16 +4474,18 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
44744474
}
44754475
}
44764476

4477+
// Assume that if the updates contains no encoded channel, that the channel remained unchanged. We
4478+
// therefore do not update the monitor.
4479+
if let Some(encoded_channel) = updates.encoded_channel.as_ref() {
4480+
self.update_encoded_channel(encoded_channel.clone());
4481+
}
4482+
44774483
if ret.is_ok() {
44784484
if self.no_further_updates_allowed() && is_pre_close_update {
44794485
log_error!(logger, "Refusing Channel Monitor Update as counterparty attempted to update commitment after funding was spent");
44804486
Err(())
44814487
} else {
4482-
// Assume that if the updates contains no encoded channel, that the channel remained unchanged. We
4483-
// therefore do not update the monitor.
4484-
if let Some(encoded_channel) = updates.encoded_channel.as_ref() {
4485-
self.update_encoded_channel(encoded_channel.clone());
4486-
}
4488+
44874489
Ok(())
44884490
}
44894491
} else { ret }

0 commit comments

Comments
 (0)