@@ -1270,6 +1270,39 @@ pub struct ChannelCounterparty {
1270
1270
pub outbound_htlc_maximum_msat : Option < u64 > ,
1271
1271
}
1272
1272
1273
+ /// An enum gathering stats on pending HTLCs, either inbound or outbound side.
1274
+ #[ derive( Debug , Clone , Copy , PartialEq ) ]
1275
+ pub struct HTLCStats {
1276
+ /// The number of pending HTLCs.
1277
+ pub pending_htlcs : u32 ,
1278
+ /// The total value of pending HTLCs.
1279
+ pub pending_htlcs_value_msat : u64 ,
1280
+ /// The total dust exposure for the counterparty.
1281
+ pub on_counterparty_tx_dust_exposure_msat : u64 ,
1282
+ /// The total dust exposure for the local node.
1283
+ pub on_holder_tx_dust_exposure_msat : u64 ,
1284
+ /// The total value of pending, outgoing HTLCs being held.
1285
+ ///
1286
+ /// These HTLCs are being held temporarily after sending commitment_signed to discern them
1287
+ /// from HTLCs implicitly included in the counterparty's revoke_and_ack.
1288
+ pub holding_cell_msat : u64 ,
1289
+ /// The number of pending, outgoing HTLCs being added that are being held,
1290
+ /// dust HTLCS not included.
1291
+ ///
1292
+ /// These HTLCs are being held temporarily after sending commitment_signed to discern them
1293
+ /// from HTLCs implicitly included in the counterparty's revoke_and_ack.
1294
+ pub on_holder_tx_holding_cell_htlcs_count : u32 ,
1295
+ }
1296
+
1297
+ impl_writeable_tlv_based ! ( HTLCStats , {
1298
+ ( 0 , pending_htlcs, required) ,
1299
+ ( 2 , pending_htlcs_value_msat, required) ,
1300
+ ( 4 , on_counterparty_tx_dust_exposure_msat, required) ,
1301
+ ( 6 , on_holder_tx_dust_exposure_msat, required) ,
1302
+ ( 8 , holding_cell_msat, required) ,
1303
+ ( 10 , on_holder_tx_holding_cell_htlcs_count, required) ,
1304
+ } ) ;
1305
+
1273
1306
/// Details of a channel, as returned by [`ChannelManager::list_channels`] and [`ChannelManager::list_usable_channels`]
1274
1307
#[ derive( Clone , Debug , PartialEq ) ]
1275
1308
pub struct ChannelDetails {
@@ -1441,6 +1474,14 @@ pub struct ChannelDetails {
1441
1474
///
1442
1475
/// This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109.
1443
1476
pub config : Option < ChannelConfig > ,
1477
+ /// Statistics on pending incoming HTLCs.
1478
+ ///
1479
+ /// This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.116.
1480
+ pub incoming_htlc_stats : Option < HTLCStats > ,
1481
+ /// Statistics on pending outgoing HTLCs.
1482
+ ///
1483
+ /// This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.116.
1484
+ pub outgoing_htlc_stats : Option < HTLCStats > ,
1444
1485
}
1445
1486
1446
1487
impl ChannelDetails {
@@ -1512,6 +1553,8 @@ impl ChannelDetails {
1512
1553
inbound_htlc_minimum_msat : Some ( channel. get_holder_htlc_minimum_msat ( ) ) ,
1513
1554
inbound_htlc_maximum_msat : channel. get_holder_htlc_maximum_msat ( ) ,
1514
1555
config : Some ( channel. config ( ) ) ,
1556
+ incoming_htlc_stats : Some ( channel. get_inbound_pending_htlc_stats ( None ) ) ,
1557
+ outgoing_htlc_stats : Some ( channel. get_outbound_pending_htlc_stats ( None ) ) ,
1515
1558
}
1516
1559
}
1517
1560
}
@@ -7190,6 +7233,8 @@ impl Writeable for ChannelDetails {
7190
7233
( 35 , self . inbound_htlc_maximum_msat, option) ,
7191
7234
( 37 , user_channel_id_high_opt, option) ,
7192
7235
( 39 , self . feerate_sat_per_1000_weight, option) ,
7236
+ ( 41 , self . incoming_htlc_stats, option) ,
7237
+ ( 43 , self . outgoing_htlc_stats, option) ,
7193
7238
} ) ;
7194
7239
Ok ( ( ) )
7195
7240
}
@@ -7227,6 +7272,8 @@ impl Readable for ChannelDetails {
7227
7272
( 35 , inbound_htlc_maximum_msat, option) ,
7228
7273
( 37 , user_channel_id_high_opt, option) ,
7229
7274
( 39 , feerate_sat_per_1000_weight, option) ,
7275
+ ( 40 , incoming_htlc_stats, option) ,
7276
+ ( 41 , outgoing_htlc_stats, option) ,
7230
7277
} ) ;
7231
7278
7232
7279
// `user_channel_id` used to be a single u64 value. In order to remain backwards compatible with
@@ -7262,6 +7309,8 @@ impl Readable for ChannelDetails {
7262
7309
inbound_htlc_minimum_msat,
7263
7310
inbound_htlc_maximum_msat,
7264
7311
feerate_sat_per_1000_weight,
7312
+ incoming_htlc_stats,
7313
+ outgoing_htlc_stats,
7265
7314
} )
7266
7315
}
7267
7316
}
0 commit comments