X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Futil%2Fevents.rs;h=8ddd762e97036bac77fee08c2be7819ec707388e;hb=4cd990142780233d163b68f21ada293656ca6b54;hp=5075a3f1f0af9b13ea3c5e79bd68c96dcad13170;hpb=6b0afbe4d46e2bf71ce8c54a05ab1beb7d38e36d;p=rust-lightning diff --git a/lightning/src/util/events.rs b/lightning/src/util/events.rs index 5075a3f1..8ddd762e 100644 --- a/lightning/src/util/events.rs +++ b/lightning/src/util/events.rs @@ -376,7 +376,7 @@ pub enum Event { /// Indicates the payment was rejected for some reason by the recipient. This implies that /// the payment has failed, not just the route in question. If this is not set, you may /// retry the payment via a different route. - rejected_by_dest: bool, + payment_failed_permanently: bool, /// Any failure information conveyed via the Onion return packet by a node along the failed /// payment route. /// @@ -643,7 +643,7 @@ impl Writeable for Event { }); }, &Event::PaymentPathFailed { - ref payment_id, ref payment_hash, ref rejected_by_dest, ref network_update, + ref payment_id, ref payment_hash, ref payment_failed_permanently, ref network_update, ref all_paths_failed, ref path, ref short_channel_id, ref retry, #[cfg(test)] ref error_code, @@ -658,7 +658,7 @@ impl Writeable for Event { write_tlv_fields!(writer, { (0, payment_hash, required), (1, network_update, option), - (2, rejected_by_dest, required), + (2, payment_failed_permanently, required), (3, all_paths_failed, required), (5, path, vec_type), (7, short_channel_id, option), @@ -827,7 +827,7 @@ impl MaybeReadable for Event { #[cfg(test)] let error_data = Readable::read(reader)?; let mut payment_hash = PaymentHash([0; 32]); - let mut rejected_by_dest = false; + let mut payment_failed_permanently = false; let mut network_update = None; let mut all_paths_failed = Some(true); let mut path: Option> = Some(vec![]); @@ -837,7 +837,7 @@ impl MaybeReadable for Event { read_tlv_fields!(reader, { (0, payment_hash, required), (1, network_update, ignorable), - (2, rejected_by_dest, required), + (2, payment_failed_permanently, required), (3, all_paths_failed, option), (5, path, vec_type), (7, short_channel_id, option), @@ -847,7 +847,7 @@ impl MaybeReadable for Event { Ok(Some(Event::PaymentPathFailed { payment_id, payment_hash, - rejected_by_dest, + payment_failed_permanently, network_update, all_paths_failed: all_paths_failed.unwrap(), path: path.unwrap(), @@ -1002,7 +1002,7 @@ impl MaybeReadable for Event { (4, path, vec_type), (6, short_channel_id, option), }); - Ok(Some(Event::ProbeFailed{ + Ok(Some(Event::ProbeFailed { payment_id, payment_hash, path: path.unwrap(), @@ -1011,6 +1011,28 @@ impl MaybeReadable for Event { }; f() }, + 25u8 => { + let f = || { + let mut prev_channel_id = [0; 32]; + let mut failed_next_destination_opt = None; + read_tlv_fields!(reader, { + (0, prev_channel_id, required), + (2, failed_next_destination_opt, ignorable), + }); + if let Some(failed_next_destination) = failed_next_destination_opt { + Ok(Some(Event::HTLCHandlingFailed { + prev_channel_id, + failed_next_destination, + })) + } else { + // If we fail to read a `failed_next_destination` assume it's because + // `MaybeReadable::read` returned `Ok(None)`, though it's also possible we + // were simply missing the field. + Ok(None) + } + }; + 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 // reads. @@ -1128,22 +1150,19 @@ pub enum MessageSendEvent { /// Used to indicate that a channel_announcement and channel_update should be broadcast to all /// peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2). /// - /// Note that after doing so, you very likely (unless you did so very recently) want to call - /// ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event. - /// This ensures that any nodes which see our channel_announcement also have a relevant + /// Note that after doing so, you very likely (unless you did so very recently) want to + /// broadcast a node_announcement (e.g. via [`PeerManager::broadcast_node_announcement`]). This + /// ensures that any nodes which see our channel_announcement also have a relevant /// node_announcement, including relevant feature flags which may be important for routing /// through or to us. + /// + /// [`PeerManager::broadcast_node_announcement`]: crate::ln::peer_handler::PeerManager::broadcast_node_announcement BroadcastChannelAnnouncement { /// The channel_announcement which should be sent. msg: msgs::ChannelAnnouncement, /// The followup channel_update which should be sent. update_msg: msgs::ChannelUpdate, }, - /// Used to indicate that a node_announcement should be broadcast to all peers. - BroadcastNodeAnnouncement { - /// The node_announcement which should be sent. - msg: msgs::NodeAnnouncement, - }, /// Used to indicate that a channel_update should be broadcast to all peers. BroadcastChannelUpdate { /// The channel_update which should be sent.