@@ -1159,7 +1159,11 @@ pub enum Event {
1159
1159
error_code : Option < u16 > ,
1160
1160
#[ cfg( any( test, feature = "_test_utils" ) ) ]
1161
1161
error_data : Option < Vec < u8 > > ,
1162
- #[ cfg( any( test, feature = "_test_utils" ) ) ]
1162
+ /// The hold times as reported by each hop. The unit in which the hold times are expressed are 100's of
1163
+ /// milliseconds. So a hop reporting 2 is a hold time that corresponds to roughly 200 milliseconds. As earlier
1164
+ /// hops hold on to an HTLC for longer, the hold times in the list are expected to decrease. When our peer
1165
+ /// didn't provide attribution data, the list is empty. The same applies to HTLCs that were resolved onchain.
1166
+ /// Because of unavailability of hold times, the list may be shorter than the number of hops in the path.
1163
1167
hold_times : Vec < u32 > ,
1164
1168
} ,
1165
1169
/// Indicates that a probe payment we sent returned successful, i.e., only failed at the destination.
@@ -1798,16 +1802,13 @@ impl Writeable for Event {
1798
1802
ref error_code,
1799
1803
#[ cfg( any( test, feature = "_test_utils") ) ]
1800
1804
ref error_data,
1801
- #[ cfg( any( test, feature = "_test_utils") ) ]
1802
1805
ref hold_times,
1803
1806
} => {
1804
1807
3u8 . write ( writer) ?;
1805
1808
#[ cfg( any( test, feature = "_test_utils" ) ) ]
1806
1809
error_code. write ( writer) ?;
1807
1810
#[ cfg( any( test, feature = "_test_utils" ) ) ]
1808
1811
error_data. write ( writer) ?;
1809
- #[ cfg( any( test, feature = "_test_utils" ) ) ]
1810
- hold_times. write ( writer) ?;
1811
1812
write_tlv_fields ! ( writer, {
1812
1813
( 0 , payment_hash, required) ,
1813
1814
( 1 , None :: <NetworkUpdate >, option) , // network_update in LDK versions prior to 0.0.114
@@ -1819,6 +1820,7 @@ impl Writeable for Event {
1819
1820
( 9 , None :: <RouteParameters >, option) , // retry in LDK versions prior to 0.0.115
1820
1821
( 11 , payment_id, option) ,
1821
1822
( 13 , failure, required) ,
1823
+ ( 15 , * hold_times, optional_vec) ,
1822
1824
} ) ;
1823
1825
} ,
1824
1826
& Event :: PendingHTLCsForwardable { time_forwardable : _ } => {
@@ -2244,8 +2246,6 @@ impl MaybeReadable for Event {
2244
2246
let error_code = Readable :: read ( reader) ?;
2245
2247
#[ cfg( any( test, feature = "_test_utils" ) ) ]
2246
2248
let error_data = Readable :: read ( reader) ?;
2247
- #[ cfg( any( test, feature = "_test_utils" ) ) ]
2248
- let hold_times = Readable :: read ( reader) ?;
2249
2249
let mut payment_hash = PaymentHash ( [ 0 ; 32 ] ) ;
2250
2250
let mut payment_failed_permanently = false ;
2251
2251
let mut network_update = None ;
@@ -2254,6 +2254,7 @@ impl MaybeReadable for Event {
2254
2254
let mut short_channel_id = None ;
2255
2255
let mut payment_id = None ;
2256
2256
let mut failure_opt = None ;
2257
+ let mut hold_times = None ;
2257
2258
read_tlv_fields ! ( reader, {
2258
2259
( 0 , payment_hash, required) ,
2259
2260
( 1 , network_update, upgradable_option) ,
@@ -2265,7 +2266,9 @@ impl MaybeReadable for Event {
2265
2266
( 7 , short_channel_id, option) ,
2266
2267
( 11 , payment_id, option) ,
2267
2268
( 13 , failure_opt, upgradable_option) ,
2269
+ ( 15 , hold_times, optional_vec) ,
2268
2270
} ) ;
2271
+ let hold_times = hold_times. unwrap_or ( Vec :: new ( ) ) ;
2269
2272
let failure =
2270
2273
failure_opt. unwrap_or_else ( || PathFailure :: OnPath { network_update } ) ;
2271
2274
Ok ( Some ( Event :: PaymentPathFailed {
@@ -2279,7 +2282,6 @@ impl MaybeReadable for Event {
2279
2282
error_code,
2280
2283
#[ cfg( any( test, feature = "_test_utils" ) ) ]
2281
2284
error_data,
2282
- #[ cfg( any( test, feature = "_test_utils" ) ) ]
2283
2285
hold_times,
2284
2286
} ) )
2285
2287
} ;
0 commit comments