@@ -1293,6 +1293,17 @@ pub enum Event {
1293
1293
/// status of the closing tx.
1294
1294
/// Note that for instances serialized in v0.0.119 or prior this will be missing (None).
1295
1295
channel_funding_txo : Option < transaction:: OutPoint > ,
1296
+ /// An upper bound on the our last local balance in msats before the channel was closed.
1297
+ ///
1298
+ /// Will overstate our balance as it ignores pending outbound HTLCs and transaction fees.
1299
+ ///
1300
+ /// For more accurate balances including fee information see
1301
+ /// [`ChainMonitor::get_claimable_balances`].
1302
+ ///
1303
+ /// This field will be `None` only for objects serialized prior to LDK 0.1.
1304
+ ///
1305
+ /// [`ChainMonitor::get_claimable_balances`]: crate::chain::chainmonitor::ChainMonitor::get_claimable_balances
1306
+ last_local_balance_msat : Option < u64 > ,
1296
1307
} ,
1297
1308
/// Used to indicate to the user that they can abandon the funding transaction and recycle the
1298
1309
/// inputs for another purpose.
@@ -1573,7 +1584,8 @@ impl Writeable for Event {
1573
1584
} ) ;
1574
1585
} ,
1575
1586
& Event :: ChannelClosed { ref channel_id, ref user_channel_id, ref reason,
1576
- ref counterparty_node_id, ref channel_capacity_sats, ref channel_funding_txo
1587
+ ref counterparty_node_id, ref channel_capacity_sats, ref channel_funding_txo,
1588
+ ref last_local_balance_msat,
1577
1589
} => {
1578
1590
9u8 . write ( writer) ?;
1579
1591
// `user_channel_id` used to be a single u64 value. In order to remain backwards
@@ -1589,6 +1601,7 @@ impl Writeable for Event {
1589
1601
( 5 , counterparty_node_id, option) ,
1590
1602
( 7 , channel_capacity_sats, option) ,
1591
1603
( 9 , channel_funding_txo, option) ,
1604
+ ( 11 , last_local_balance_msat, option)
1592
1605
} ) ;
1593
1606
} ,
1594
1607
& Event :: DiscardFunding { ref channel_id, ref funding_info } => {
@@ -1964,6 +1977,7 @@ impl MaybeReadable for Event {
1964
1977
let mut counterparty_node_id = None ;
1965
1978
let mut channel_capacity_sats = None ;
1966
1979
let mut channel_funding_txo = None ;
1980
+ let mut last_local_balance_msat = None ;
1967
1981
read_tlv_fields ! ( reader, {
1968
1982
( 0 , channel_id, required) ,
1969
1983
( 1 , user_channel_id_low_opt, option) ,
@@ -1972,6 +1986,7 @@ impl MaybeReadable for Event {
1972
1986
( 5 , counterparty_node_id, option) ,
1973
1987
( 7 , channel_capacity_sats, option) ,
1974
1988
( 9 , channel_funding_txo, option) ,
1989
+ ( 11 , last_local_balance_msat, option)
1975
1990
} ) ;
1976
1991
1977
1992
// `user_channel_id` used to be a single u64 value. In order to remain
@@ -1980,8 +1995,10 @@ impl MaybeReadable for Event {
1980
1995
let user_channel_id = ( user_channel_id_low_opt. unwrap_or ( 0 ) as u128 ) +
1981
1996
( ( user_channel_id_high_opt. unwrap_or ( 0 ) as u128 ) << 64 ) ;
1982
1997
1983
- Ok ( Some ( Event :: ChannelClosed { channel_id, user_channel_id, reason : _init_tlv_based_struct_field ! ( reason, upgradable_required) ,
1984
- counterparty_node_id, channel_capacity_sats, channel_funding_txo } ) )
1998
+ Ok ( Some ( Event :: ChannelClosed {
1999
+ channel_id, user_channel_id, reason : _init_tlv_based_struct_field ! ( reason, upgradable_required) ,
2000
+ counterparty_node_id, channel_capacity_sats, channel_funding_txo, last_local_balance_msat,
2001
+ } ) )
1985
2002
} ;
1986
2003
f ( )
1987
2004
} ,
0 commit comments