@@ -18,6 +18,7 @@ use chain::keysinterface::SpendableOutputDescriptor;
18
18
use ln:: msgs;
19
19
use ln:: { PaymentPreimage , PaymentHash , PaymentSecret } ;
20
20
use routing:: network_graph:: NetworkUpdate ;
21
+ use routing:: router:: RouteHop ;
21
22
use util:: ser:: { Writeable , Writer , MaybeReadable , Readable , VecReadWrapper , VecWriteWrapper } ;
22
23
23
24
use bitcoin:: blockdata:: script:: Script ;
@@ -147,6 +148,14 @@ pub enum Event {
147
148
#[ cfg( test) ]
148
149
error_data : Option < Vec < u8 > > ,
149
150
} ,
151
+ /// Indicates an outbound MPP payment partially failed. Probably some intermediary node dropped
152
+ /// something. You may wish to retry this portion of the payment with a different path.
153
+ MPPFragmentFailed {
154
+ /// The hash which was given to ChannelManager::send_payment.
155
+ payment_hash : PaymentHash ,
156
+ /// The path that failed.
157
+ payment_path : Vec < RouteHop > ,
158
+ } ,
150
159
/// Used to indicate that ChannelManager::process_pending_htlc_forwards should be called at a
151
160
/// time in the future.
152
161
PendingHTLCsForwardable {
@@ -261,6 +270,13 @@ impl Writeable for Event {
261
270
( 2 , claim_from_onchain_tx, required) ,
262
271
} ) ;
263
272
} ,
273
+ & Event :: MPPFragmentFailed { ref payment_hash, ref payment_path } => {
274
+ 9u8 . write ( writer) ?;
275
+ write_tlv_fields ! ( writer, {
276
+ ( 0 , payment_hash, required) ,
277
+ ( 2 , payment_path, vec_type) ,
278
+ } ) ;
279
+ } ,
264
280
}
265
281
Ok ( ( ) )
266
282
}
@@ -371,6 +387,18 @@ impl MaybeReadable for Event {
371
387
} ;
372
388
f ( )
373
389
} ,
390
+ 9u8 => {
391
+ let f = || {
392
+ let mut payment_hash = PaymentHash ( [ 0 ; 32 ] ) ;
393
+ let mut payment_path = None ;
394
+ read_tlv_fields ! ( reader, {
395
+ ( 0 , payment_hash, required) ,
396
+ ( 2 , payment_path, vec_type) ,
397
+ } ) ;
398
+ Ok ( Some ( Event :: MPPFragmentFailed { payment_hash, payment_path : payment_path. unwrap ( ) } ) )
399
+ } ;
400
+ f ( )
401
+ }
374
402
// Versions prior to 0.0.100 did not ignore odd types, instead returning InvalidValue.
375
403
x if x % 2 == 1 => Ok ( None ) ,
376
404
_ => Err ( msgs:: DecodeError :: InvalidValue )
0 commit comments