- }
- }
-
- macro_rules! fail_dust_htlcs_after_threshold_conf {
- ($holder_tx: expr, $commitment_tx: expr) => {
- for &(ref htlc, _, ref source) in &$holder_tx.htlc_outputs {
- if htlc.transaction_output_index.is_none() {
- if let &Some(ref source) = source {
- self.onchain_events_awaiting_threshold_conf.retain(|ref entry| {
- if entry.height != height { return true; }
- match entry.event {
- OnchainEvent::HTLCUpdate { source: ref update_source, .. } => {
- update_source != source
- },
- _ => true,
- }
- });
- let entry = OnchainEventEntry {
- txid: commitment_txid,
- height,
- event: OnchainEvent::HTLCUpdate {
- source: source.clone(), payment_hash: htlc.payment_hash,
- onchain_value_satoshis: Some(htlc.amount_msat / 1000)
- },
- };
- log_trace!(logger, "Failing HTLC with payment_hash {} from {} holder commitment tx due to broadcast of transaction, waiting confirmation (at height{})",
- log_bytes!(htlc.payment_hash.0), $commitment_tx, entry.confirmation_threshold());
- self.onchain_events_awaiting_threshold_conf.push(entry);
- }
- }
- }
+ fail_unbroadcast_htlcs!(self, "previous holder", height, holder_tx.htlc_outputs.iter().map(|(a, _, c)| (a, c.as_ref())), logger);