@@ -234,6 +234,28 @@ pub enum Event {
234234 /// This will be `None` for events serialized by LDK Node v0.2.1 and prior.
235235 reason : Option < ClosureReason > ,
236236 } ,
237+ /// A channel splice is pending confirmation on-chain.
238+ SplicePending {
239+ /// The `channel_id` of the channel.
240+ channel_id : ChannelId ,
241+ /// The `user_channel_id` of the channel.
242+ user_channel_id : UserChannelId ,
243+ /// The `node_id` of the channel counterparty.
244+ counterparty_node_id : PublicKey ,
245+ /// The outpoint of the channel's splice funding transaction.
246+ new_funding_txo : OutPoint ,
247+ } ,
248+ /// A channel splice has failed.
249+ SpliceFailed {
250+ /// The `channel_id` of the channel.
251+ channel_id : ChannelId ,
252+ /// The `user_channel_id` of the channel.
253+ user_channel_id : UserChannelId ,
254+ /// The `node_id` of the channel counterparty.
255+ counterparty_node_id : PublicKey ,
256+ /// The outpoint of the channel's splice funding transaction.
257+ abandoned_funding_txo : Option < OutPoint > ,
258+ } ,
237259}
238260
239261impl_writeable_tlv_based_enum ! ( Event ,
@@ -291,7 +313,19 @@ impl_writeable_tlv_based_enum!(Event,
291313 ( 10 , skimmed_fee_msat, option) ,
292314 ( 12 , claim_from_onchain_tx, required) ,
293315 ( 14 , outbound_amount_forwarded_msat, option) ,
294- }
316+ } ,
317+ ( 8 , SplicePending ) => {
318+ ( 1 , channel_id, required) ,
319+ ( 3 , counterparty_node_id, required) ,
320+ ( 5 , user_channel_id, required) ,
321+ ( 7 , new_funding_txo, required) ,
322+ } ,
323+ ( 9 , SpliceFailed ) => {
324+ ( 1 , channel_id, required) ,
325+ ( 3 , counterparty_node_id, required) ,
326+ ( 5 , user_channel_id, required) ,
327+ ( 7 , abandoned_funding_txo, option) ,
328+ } ,
295329) ;
296330
297331pub struct EventQueue < L : Deref >
@@ -1611,17 +1645,74 @@ where
16111645 LdkEvent :: FundingTransactionReadyForSigning { .. } => {
16121646 debug_assert ! ( false , "We currently don't support interactive-tx, so this event should never be emitted." ) ;
16131647 } ,
1614- LdkEvent :: SplicePending { .. } => {
1615- debug_assert ! (
1616- false ,
1617- "We currently don't support splicing, so this event should never be emitted."
1648+ LdkEvent :: SplicePending {
1649+ channel_id,
1650+ user_channel_id,
1651+ counterparty_node_id,
1652+ new_funding_txo,
1653+ ..
1654+ } => {
1655+ log_info ! (
1656+ self . logger,
1657+ "Channel {} with counterparty {} pending splice with funding_txo {}" ,
1658+ channel_id,
1659+ counterparty_node_id,
1660+ new_funding_txo,
16181661 ) ;
1662+
1663+ let event = Event :: SplicePending {
1664+ channel_id,
1665+ user_channel_id : UserChannelId ( user_channel_id) ,
1666+ counterparty_node_id,
1667+ new_funding_txo,
1668+ } ;
1669+
1670+ match self . event_queue . add_event ( event) {
1671+ Ok ( _) => { } ,
1672+ Err ( e) => {
1673+ log_error ! ( self . logger, "Failed to push to event queue: {}" , e) ;
1674+ return Err ( ReplayEvent ( ) ) ;
1675+ } ,
1676+ } ;
16191677 } ,
1620- LdkEvent :: SpliceFailed { .. } => {
1621- debug_assert ! (
1622- false ,
1623- "We currently don't support splicing, so this event should never be emitted."
1624- ) ;
1678+ LdkEvent :: SpliceFailed {
1679+ channel_id,
1680+ user_channel_id,
1681+ counterparty_node_id,
1682+ abandoned_funding_txo,
1683+ ..
1684+ } => {
1685+ if let Some ( funding_txo) = abandoned_funding_txo {
1686+ log_info ! (
1687+ self . logger,
1688+ "Channel {} with counterparty {} failed splice with funding_txo {}" ,
1689+ channel_id,
1690+ counterparty_node_id,
1691+ funding_txo,
1692+ ) ;
1693+ } else {
1694+ log_info ! (
1695+ self . logger,
1696+ "Channel {} with counterparty {} failed splice" ,
1697+ channel_id,
1698+ counterparty_node_id,
1699+ ) ;
1700+ }
1701+
1702+ let event = Event :: SpliceFailed {
1703+ channel_id,
1704+ user_channel_id : UserChannelId ( user_channel_id) ,
1705+ counterparty_node_id,
1706+ abandoned_funding_txo,
1707+ } ;
1708+
1709+ match self . event_queue . add_event ( event) {
1710+ Ok ( _) => { } ,
1711+ Err ( e) => {
1712+ log_error ! ( self . logger, "Failed to push to event queue: {}" , e) ;
1713+ return Err ( ReplayEvent ( ) ) ;
1714+ } ,
1715+ } ;
16251716 } ,
16261717 }
16271718 Ok ( ( ) )
0 commit comments