all_paths_failed: bool,
/// The payment path that failed.
path: Vec<RouteHop>,
+ /// The channel responsible for the failed payment path.
+ ///
+ /// If this is `Some`, then the corresponding channel should be avoided when the payment is
+ /// retried. May be `None` for older [`Event`] serializations.
+ short_channel_id: Option<u64>,
#[cfg(test)]
error_code: Option<u16>,
#[cfg(test)]
});
},
&Event::PaymentPathFailed { ref payment_hash, ref rejected_by_dest, ref network_update,
- ref all_paths_failed, ref path,
+ ref all_paths_failed, ref path, ref short_channel_id,
#[cfg(test)]
ref error_code,
#[cfg(test)]
(2, rejected_by_dest, required),
(3, all_paths_failed, required),
(5, path, vec_type),
+ (7, short_channel_id, option),
});
},
&Event::PendingHTLCsForwardable { time_forwardable: _ } => {
let mut network_update = None;
let mut all_paths_failed = Some(true);
let mut path: Option<Vec<RouteHop>> = Some(vec![]);
+ let mut short_channel_id = None;
read_tlv_fields!(reader, {
(0, payment_hash, required),
(1, network_update, ignorable),
(2, rejected_by_dest, required),
(3, all_paths_failed, option),
(5, path, vec_type),
+ (7, short_channel_id, ignorable),
});
Ok(Some(Event::PaymentPathFailed {
payment_hash,
network_update,
all_paths_failed: all_paths_failed.unwrap(),
path: path.unwrap(),
+ short_channel_id,
#[cfg(test)]
error_code,
#[cfg(test)]
f()
},
9u8 => {
- let mut channel_id = [0; 32];
- let mut reason = None;
- read_tlv_fields!(reader, {
- (0, channel_id, required),
- (2, reason, ignorable),
- });
- if reason.is_none() { return Ok(None); }
- Ok(Some(Event::ChannelClosed { channel_id, reason: reason.unwrap() }))
+ let f = || {
+ let mut channel_id = [0; 32];
+ let mut reason = None;
+ read_tlv_fields!(reader, {
+ (0, channel_id, required),
+ (2, reason, ignorable),
+ });
+ if reason.is_none() { return Ok(None); }
+ Ok(Some(Event::ChannelClosed { channel_id, reason: reason.unwrap() }))
+ };
+ f()
},
11u8 => {
- let mut channel_id = [0; 32];
- let mut transaction = Transaction{ version: 2, lock_time: 0, input: Vec::new(), output: Vec::new() };
- read_tlv_fields!(reader, {
- (0, channel_id, required),
- (2, transaction, required),
- });
- Ok(Some(Event::DiscardFunding { channel_id, transaction } ))
+ let f = || {
+ let mut channel_id = [0; 32];
+ let mut transaction = Transaction{ version: 2, lock_time: 0, input: Vec::new(), output: Vec::new() };
+ read_tlv_fields!(reader, {
+ (0, channel_id, required),
+ (2, transaction, required),
+ });
+ Ok(Some(Event::DiscardFunding { channel_id, transaction } ))
+ };
+ f()
},
// Versions prior to 0.0.100 did not ignore odd types, instead returning InvalidValue.
// Version 0.0.100 failed to properly ignore odd types, possibly resulting in corrupt