);
#[derive(Clone, Debug, PartialEq, Eq)]
-/// The reason the channel was closed. See individual variants more details.
+/// The reason the channel was closed. See individual variants for more details.
pub enum ClosureReason {
/// Closure generated from receiving a peer error message.
///
///
/// [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
/// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
- OutdatedChannelManager
+ OutdatedChannelManager,
+ /// The counterparty requested a cooperative close of a channel that had not been funded yet.
+ /// The channel has been immediately closed.
+ CounterpartyCoopClosedUnfundedChannel,
}
impl core::fmt::Display for ClosureReason {
},
ClosureReason::DisconnectedPeer => f.write_str("the peer disconnected prior to the channel being funded"),
ClosureReason::OutdatedChannelManager => f.write_str("the ChannelManager read from disk was stale compared to ChannelMonitor(s)"),
+ ClosureReason::CounterpartyCoopClosedUnfundedChannel => f.write_str("the peer requested the unfunded channel be closed"),
}
}
}
(8, ProcessingError) => { (1, err, required) },
(10, DisconnectedPeer) => {},
(12, OutdatedChannelManager) => {},
+ (13, CounterpartyCoopClosedUnfundedChannel) => {},
);
/// Intended destination of a failed HTLC as indicated in [`Event::HTLCHandlingFailed`].
/// Indicates that a transaction originating from LDK needs to have its fee bumped. This event
/// requires confirmed external funds to be readily available to spend.
///
- /// LDK does not currently generate this event. It is limited to the scope of channels with
- /// anchor outputs, which will be introduced in a future release.
+ /// LDK does not currently generate this event unless the
+ /// [`ChannelHandshakeConfig::negotiate_anchors_zero_fee_htlc_tx`] config flag is set to true.
+ /// It is limited to the scope of channels with anchor outputs.
+ ///
+ /// [`ChannelHandshakeConfig::negotiate_anchors_zero_fee_htlc_tx`]: crate::util::config::ChannelHandshakeConfig::negotiate_anchors_zero_fee_htlc_tx
BumpTransaction(BumpTransactionEvent),
}
(2, payment_failed_permanently, required),
(3, false, required), // all_paths_failed in LDK versions prior to 0.0.114
(4, path.blinded_tail, option),
- (5, path.hops, vec_type),
+ (5, path.hops, required_vec),
(7, short_channel_id, option),
(9, None::<RouteParameters>, option), // retry in LDK versions prior to 0.0.115
(11, payment_id, option),
write_tlv_fields!(writer, {
(0, payment_id, required),
(2, payment_hash, option),
- (4, path.hops, vec_type),
+ (4, path.hops, required_vec),
(6, path.blinded_tail, option),
})
},
write_tlv_fields!(writer, {
(0, payment_id, required),
(2, payment_hash, required),
- (4, path.hops, vec_type),
+ (4, path.hops, required_vec),
(6, path.blinded_tail, option),
})
},
write_tlv_fields!(writer, {
(0, payment_id, required),
(2, payment_hash, required),
- (4, path.hops, vec_type),
+ (4, path.hops, required_vec),
(6, short_channel_id, option),
(8, path.blinded_tail, option),
})
(1, network_update, upgradable_option),
(2, payment_failed_permanently, required),
(4, blinded_tail, option),
- (5, path, vec_type),
+ // Added as a part of LDK 0.0.101 and always filled in since.
+ // Defaults to an empty Vec, though likely should have been `Option`al.
+ (5, path, optional_vec),
(7, short_channel_id, option),
(11, payment_id, option),
(13, failure_opt, upgradable_option),
_init_and_read_tlv_fields!(reader, {
(0, payment_id, required),
(2, payment_hash, option),
- (4, path, vec_type),
+ (4, path, required_vec),
(6, blinded_tail, option),
});
Ok(Some(Event::PaymentPathSuccessful {
payment_id: payment_id.0.unwrap(),
payment_hash,
- path: Path { hops: path.unwrap(), blinded_tail },
+ path: Path { hops: path, blinded_tail },
}))
};
f()
_init_and_read_tlv_fields!(reader, {
(0, payment_id, required),
(2, payment_hash, required),
- (4, path, vec_type),
+ (4, path, required_vec),
(6, blinded_tail, option),
});
Ok(Some(Event::ProbeSuccessful {
payment_id: payment_id.0.unwrap(),
payment_hash: payment_hash.0.unwrap(),
- path: Path { hops: path.unwrap(), blinded_tail },
+ path: Path { hops: path, blinded_tail },
}))
};
f()
_init_and_read_tlv_fields!(reader, {
(0, payment_id, required),
(2, payment_hash, required),
- (4, path, vec_type),
+ (4, path, required_vec),
(6, short_channel_id, option),
(8, blinded_tail, option),
});
Ok(Some(Event::ProbeFailed {
payment_id: payment_id.0.unwrap(),
payment_hash: payment_hash.0.unwrap(),
- path: Path { hops: path.unwrap(), blinded_tail },
+ path: Path { hops: path, blinded_tail },
short_channel_id,
}))
};