|
17 | 17 | use ln::msgs; |
18 | 18 | use ln::{PaymentPreimage, PaymentHash, PaymentSecret}; |
19 | 19 | use chain::keysinterface::SpendableOutputDescriptor; |
| 20 | +use routing::router::RouteHop; |
20 | 21 | use util::ser::{Writeable, Writer, MaybeReadable, Readable, VecReadWrapper, VecWriteWrapper}; |
21 | 22 |
|
22 | 23 | use bitcoin::blockdata::script::Script; |
@@ -137,6 +138,14 @@ pub enum Event { |
137 | 138 | #[cfg(test)] |
138 | 139 | error_data: Option<Vec<u8>>, |
139 | 140 | }, |
| 141 | + /// Indicates an outbound MPP payment partially failed. Probably some intermediary node dropped |
| 142 | + /// something. You may wish to retry this portion of the payment with a different path. |
| 143 | + MPPFragmentFailed { |
| 144 | + /// The hash which was given to ChannelManager::send_payment. |
| 145 | + payment_hash: PaymentHash, |
| 146 | + /// The path that failed. |
| 147 | + payment_path: Vec<RouteHop>, |
| 148 | + }, |
140 | 149 | /// Used to indicate that ChannelManager::process_pending_htlc_forwards should be called at a |
141 | 150 | /// time in the future. |
142 | 151 | PendingHTLCsForwardable { |
@@ -250,6 +259,13 @@ impl Writeable for Event { |
250 | 259 | (2, claim_from_onchain_tx, required), |
251 | 260 | }); |
252 | 261 | }, |
| 262 | + &Event::MPPFragmentFailed { ref payment_hash, ref payment_path } => { |
| 263 | + 8u8.write(writer)?; |
| 264 | + write_tlv_fields!(writer, { |
| 265 | + (0, payment_hash, required), |
| 266 | + (2, payment_path, vec_type), |
| 267 | + }); |
| 268 | + }, |
253 | 269 | } |
254 | 270 | Ok(()) |
255 | 271 | } |
|
0 commit comments