@@ -1276,6 +1276,17 @@ pub enum Event {
12761276 /// status of the closing tx.
12771277 /// Note that for instances serialized in v0.0.119 or prior this will be missing (None).
12781278 channel_funding_txo : Option < transaction:: OutPoint > ,
1279+ /// An upper bound on the our last local balance in msats before the channel was closed.
1280+ ///
1281+ /// Will overstate our balance as it ignores pending outbound HTLCs and transaction fees.
1282+ ///
1283+ /// For more accurate balances including fee information see
1284+ /// [`ChainMonitor::get_claimable_balances`].
1285+ ///
1286+ /// This field will be `None` only for objects serialized prior to LDK 0.1.
1287+ ///
1288+ /// [`ChainMonitor::get_claimable_balances`]: crate::chain::chainmonitor::ChainMonitor::get_claimable_balances
1289+ last_local_balance_msat : Option < u64 > ,
12791290 } ,
12801291 /// Used to indicate to the user that they can abandon the funding transaction and recycle the
12811292 /// inputs for another purpose.
@@ -1555,7 +1566,8 @@ impl Writeable for Event {
15551566 } ) ;
15561567 } ,
15571568 & Event :: ChannelClosed { ref channel_id, ref user_channel_id, ref reason,
1558- ref counterparty_node_id, ref channel_capacity_sats, ref channel_funding_txo
1569+ ref counterparty_node_id, ref channel_capacity_sats, ref channel_funding_txo,
1570+ ref last_local_balance_msat,
15591571 } => {
15601572 9u8 . write ( writer) ?;
15611573 // `user_channel_id` used to be a single u64 value. In order to remain backwards
@@ -1571,6 +1583,7 @@ impl Writeable for Event {
15711583 ( 5 , counterparty_node_id, option) ,
15721584 ( 7 , channel_capacity_sats, option) ,
15731585 ( 9 , channel_funding_txo, option) ,
1586+ ( 11 , last_local_balance_msat, option)
15741587 } ) ;
15751588 } ,
15761589 & Event :: DiscardFunding { ref channel_id, ref funding_info } => {
@@ -1939,6 +1952,7 @@ impl MaybeReadable for Event {
19391952 let mut counterparty_node_id = None ;
19401953 let mut channel_capacity_sats = None ;
19411954 let mut channel_funding_txo = None ;
1955+ let mut last_local_balance_msat = None ;
19421956 read_tlv_fields ! ( reader, {
19431957 ( 0 , channel_id, required) ,
19441958 ( 1 , user_channel_id_low_opt, option) ,
@@ -1947,6 +1961,7 @@ impl MaybeReadable for Event {
19471961 ( 5 , counterparty_node_id, option) ,
19481962 ( 7 , channel_capacity_sats, option) ,
19491963 ( 9 , channel_funding_txo, option) ,
1964+ ( 11 , last_local_balance_msat, option)
19501965 } ) ;
19511966
19521967 // `user_channel_id` used to be a single u64 value. In order to remain
@@ -1955,8 +1970,10 @@ impl MaybeReadable for Event {
19551970 let user_channel_id = ( user_channel_id_low_opt. unwrap_or ( 0 ) as u128 ) +
19561971 ( ( user_channel_id_high_opt. unwrap_or ( 0 ) as u128 ) << 64 ) ;
19571972
1958- Ok ( Some ( Event :: ChannelClosed { channel_id, user_channel_id, reason : _init_tlv_based_struct_field ! ( reason, upgradable_required) ,
1959- counterparty_node_id, channel_capacity_sats, channel_funding_txo } ) )
1973+ Ok ( Some ( Event :: ChannelClosed {
1974+ channel_id, user_channel_id, reason : _init_tlv_based_struct_field ! ( reason, upgradable_required) ,
1975+ counterparty_node_id, channel_capacity_sats, channel_funding_txo, last_local_balance_msat,
1976+ } ) )
19601977 } ;
19611978 f ( )
19621979 } ,
0 commit comments