X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fchain%2Fchannelmonitor.rs;h=a41d853311ce924f388eaa5efbbb2ceb79489a64;hb=d4dc05b0d8850573d591aaf04e13e08f946dd87c;hp=93e1bb24487e2d3202cb07f35a4a27739bb79dce;hpb=d0847bd0c63a0c2c84428a231da93a66a480025e;p=rust-lightning diff --git a/lightning/src/chain/channelmonitor.rs b/lightning/src/chain/channelmonitor.rs index 93e1bb24..a41d8533 100644 --- a/lightning/src/chain/channelmonitor.rs +++ b/lightning/src/chain/channelmonitor.rs @@ -53,7 +53,7 @@ use crate::util::ser::{Readable, ReadableArgs, MaybeReadable, Writer, Writeable, use crate::util::byte_utils; use crate::util::events::Event; #[cfg(anchors)] -use crate::util::events::{AnchorDescriptor, BumpTransactionEvent}; +use crate::util::events::{AnchorDescriptor, HTLCDescriptor, BumpTransactionEvent}; use crate::prelude::*; use core::{cmp, mem}; @@ -2425,7 +2425,27 @@ impl ChannelMonitorImpl { pending_htlcs, })); }, - _ => {}, + ClaimEvent::BumpHTLC { + target_feerate_sat_per_1000_weight, htlcs, + } => { + let mut htlc_descriptors = Vec::with_capacity(htlcs.len()); + for htlc in htlcs { + htlc_descriptors.push(HTLCDescriptor { + channel_keys_id: self.channel_keys_id, + channel_value_satoshis: self.channel_value_satoshis, + channel_parameters: self.onchain_tx_handler.channel_transaction_parameters.clone(), + commitment_txid: htlc.commitment_txid, + per_commitment_number: htlc.per_commitment_number, + htlc: htlc.htlc, + preimage: htlc.preimage, + counterparty_sig: htlc.counterparty_sig, + }); + } + ret.push(Event::BumpTransaction(BumpTransactionEvent::HTLCResolution { + target_feerate_sat_per_1000_weight, + htlc_descriptors, + })); + } } } ret @@ -3012,10 +3032,10 @@ impl ChannelMonitorImpl { if let Some(new_outputs) = new_outputs_option { watch_outputs.push(new_outputs); } - // Since there may be multiple HTLCs (all from the same commitment) being - // claimed by the counterparty within the same transaction, and - // `check_spend_counterparty_htlc` already checks for all of them, we can - // safely break from our loop. + // Since there may be multiple HTLCs for this channel (all spending the + // same commitment tx) being claimed by the counterparty within the same + // transaction, and `check_spend_counterparty_htlc` already checks all the + // ones relevant to this channel, we can safely break from our loop. break; } }