@@ -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 >
@@ -1629,17 +1663,74 @@ where
16291663 LdkEvent :: FundingTransactionReadyForSigning { .. } => {
16301664 debug_assert ! ( false , "We currently don't support interactive-tx, so this event should never be emitted." ) ;
16311665 } ,
1632- LdkEvent :: SplicePending { .. } => {
1633- debug_assert ! (
1634- false ,
1635- "We currently don't support splicing, so this event should never be emitted."
1666+ LdkEvent :: SplicePending {
1667+ channel_id,
1668+ user_channel_id,
1669+ counterparty_node_id,
1670+ new_funding_txo,
1671+ ..
1672+ } => {
1673+ log_info ! (
1674+ self . logger,
1675+ "Channel {} with counterparty {} pending splice with funding_txo {}" ,
1676+ channel_id,
1677+ counterparty_node_id,
1678+ new_funding_txo,
16361679 ) ;
1680+
1681+ let event = Event :: SplicePending {
1682+ channel_id,
1683+ user_channel_id : UserChannelId ( user_channel_id) ,
1684+ counterparty_node_id,
1685+ new_funding_txo,
1686+ } ;
1687+
1688+ match self . event_queue . add_event ( event) {
1689+ Ok ( _) => { } ,
1690+ Err ( e) => {
1691+ log_error ! ( self . logger, "Failed to push to event queue: {}" , e) ;
1692+ return Err ( ReplayEvent ( ) ) ;
1693+ } ,
1694+ } ;
16371695 } ,
1638- LdkEvent :: SpliceFailed { .. } => {
1639- debug_assert ! (
1640- false ,
1641- "We currently don't support splicing, so this event should never be emitted."
1642- ) ;
1696+ LdkEvent :: SpliceFailed {
1697+ channel_id,
1698+ user_channel_id,
1699+ counterparty_node_id,
1700+ abandoned_funding_txo,
1701+ ..
1702+ } => {
1703+ if let Some ( funding_txo) = abandoned_funding_txo {
1704+ log_info ! (
1705+ self . logger,
1706+ "Channel {} with counterparty {} failed splice with funding_txo {}" ,
1707+ channel_id,
1708+ counterparty_node_id,
1709+ funding_txo,
1710+ ) ;
1711+ } else {
1712+ log_info ! (
1713+ self . logger,
1714+ "Channel {} with counterparty {} failed splice" ,
1715+ channel_id,
1716+ counterparty_node_id,
1717+ ) ;
1718+ }
1719+
1720+ let event = Event :: SpliceFailed {
1721+ channel_id,
1722+ user_channel_id : UserChannelId ( user_channel_id) ,
1723+ counterparty_node_id,
1724+ abandoned_funding_txo,
1725+ } ;
1726+
1727+ match self . event_queue . add_event ( event) {
1728+ Ok ( _) => { } ,
1729+ Err ( e) => {
1730+ log_error ! ( self . logger, "Failed to push to event queue: {}" , e) ;
1731+ return Err ( ReplayEvent ( ) ) ;
1732+ } ,
1733+ } ;
16431734 } ,
16441735 }
16451736 Ok ( ( ) )
0 commit comments