@@ -1293,6 +1293,17 @@ pub enum Event {
12931293 /// status of the closing tx.
12941294 /// Note that for instances serialized in v0.0.119 or prior this will be missing (None).
12951295 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 > ,
12961307 } ,
12971308 /// Used to indicate to the user that they can abandon the funding transaction and recycle the
12981309 /// inputs for another purpose.
@@ -1573,7 +1584,8 @@ impl Writeable for Event {
15731584 } ) ;
15741585 } ,
15751586 & 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,
15771589 } => {
15781590 9u8 . write ( writer) ?;
15791591 // `user_channel_id` used to be a single u64 value. In order to remain backwards
@@ -1589,6 +1601,7 @@ impl Writeable for Event {
15891601 ( 5 , counterparty_node_id, option) ,
15901602 ( 7 , channel_capacity_sats, option) ,
15911603 ( 9 , channel_funding_txo, option) ,
1604+ ( 11 , last_local_balance_msat, option)
15921605 } ) ;
15931606 } ,
15941607 & Event :: DiscardFunding { ref channel_id, ref funding_info } => {
@@ -1964,6 +1977,7 @@ impl MaybeReadable for Event {
19641977 let mut counterparty_node_id = None ;
19651978 let mut channel_capacity_sats = None ;
19661979 let mut channel_funding_txo = None ;
1980+ let mut last_local_balance_msat = None ;
19671981 read_tlv_fields ! ( reader, {
19681982 ( 0 , channel_id, required) ,
19691983 ( 1 , user_channel_id_low_opt, option) ,
@@ -1972,6 +1986,7 @@ impl MaybeReadable for Event {
19721986 ( 5 , counterparty_node_id, option) ,
19731987 ( 7 , channel_capacity_sats, option) ,
19741988 ( 9 , channel_funding_txo, option) ,
1989+ ( 11 , last_local_balance_msat, option)
19751990 } ) ;
19761991
19771992 // `user_channel_id` used to be a single u64 value. In order to remain
@@ -1980,8 +1995,10 @@ impl MaybeReadable for Event {
19801995 let user_channel_id = ( user_channel_id_low_opt. unwrap_or ( 0 ) as u128 ) +
19811996 ( ( user_channel_id_high_opt. unwrap_or ( 0 ) as u128 ) << 64 ) ;
19821997
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+ } ) )
19852002 } ;
19862003 f ( )
19872004 } ,
0 commit comments