@@ -424,6 +424,8 @@ pub enum Event {
424424 payment_id : PaymentId ,
425425 /// The hash of the probe payment.
426426 payment_hash : PaymentHash ,
427+ /// The total routing fee paid by the probe path, in thousandths of a satoshi.
428+ route_fee_msat : Option < u64 > ,
427429 } ,
428430 /// A sent payment probe has failed.
429431 ProbeFailed {
@@ -433,6 +435,8 @@ pub enum Event {
433435 payment_hash : PaymentHash ,
434436 /// The channel responsible for the failed probe, if known.
435437 short_channel_id : Option < u64 > ,
438+ /// The total routing fee for the failed probe path, in thousandths of a satoshi.
439+ route_fee_msat : Option < u64 > ,
436440 } ,
437441 /// A channel has been created and is pending confirmation on-chain.
438442 ChannelPending {
@@ -964,11 +968,13 @@ impl_writeable_tlv_based_enum!(Event,
964968 ( 18 , ProbeSuccessful ) => {
965969 ( 0 , payment_hash, required) ,
966970 ( 2 , payment_id, required) ,
971+ ( 4 , route_fee_msat, option) ,
967972 } ,
968973 ( 19 , ProbeFailed ) => {
969974 ( 0 , payment_hash, required) ,
970975 ( 1 , short_channel_id, option) ,
971976 ( 3 , payment_id, required) ,
977+ ( 5 , route_fee_msat, option) ,
972978 }
973979) ;
974980
@@ -1804,8 +1810,9 @@ where
18041810
18051811 LdkEvent :: PaymentPathSuccessful { .. } => { } ,
18061812 LdkEvent :: PaymentPathFailed { .. } => { } ,
1807- LdkEvent :: ProbeSuccessful { payment_id, payment_hash, .. } => {
1808- let event = Event :: ProbeSuccessful { payment_id, payment_hash } ;
1813+ LdkEvent :: ProbeSuccessful { payment_id, payment_hash, path, .. } => {
1814+ let route_fee_msat = Some ( path. fee_msat ( ) ) ;
1815+ let event = Event :: ProbeSuccessful { payment_id, payment_hash, route_fee_msat } ;
18091816 match self . event_queue . add_event ( event) . await {
18101817 Ok ( _) => { } ,
18111818 Err ( e) => {
@@ -1814,8 +1821,14 @@ where
18141821 } ,
18151822 }
18161823 } ,
1817- LdkEvent :: ProbeFailed { payment_id, payment_hash, short_channel_id, .. } => {
1818- let event = Event :: ProbeFailed { payment_id, payment_hash, short_channel_id } ;
1824+ LdkEvent :: ProbeFailed { payment_id, payment_hash, short_channel_id, path, .. } => {
1825+ let route_fee_msat = Some ( path. fee_msat ( ) ) ;
1826+ let event = Event :: ProbeFailed {
1827+ payment_id,
1828+ payment_hash,
1829+ short_channel_id,
1830+ route_fee_msat,
1831+ } ;
18191832 match self . event_queue . add_event ( event) . await {
18201833 Ok ( _) => { } ,
18211834 Err ( e) => {
@@ -2606,16 +2619,19 @@ mod tests {
26062619 Event :: ProbeSuccessful {
26072620 payment_id : PaymentId ( [ 1u8 ; 32 ] ) ,
26082621 payment_hash : PaymentHash ( [ 2u8 ; 32 ] ) ,
2622+ route_fee_msat : Some ( 1_234 ) ,
26092623 } ,
26102624 Event :: ProbeFailed {
26112625 payment_id : PaymentId ( [ 3u8 ; 32 ] ) ,
26122626 payment_hash : PaymentHash ( [ 4u8 ; 32 ] ) ,
26132627 short_channel_id : Some ( 42 ) ,
2628+ route_fee_msat : Some ( 5_678 ) ,
26142629 } ,
26152630 Event :: ProbeFailed {
26162631 payment_id : PaymentId ( [ 5u8 ; 32 ] ) ,
26172632 payment_hash : PaymentHash ( [ 6u8 ; 32 ] ) ,
26182633 short_channel_id : None ,
2634+ route_fee_msat : None ,
26192635 } ,
26202636 ] ;
26212637
0 commit comments