@@ -49,7 +49,7 @@ use bitcoin::hashes::sha256::Hash as Sha256;
49
49
use bitcoin:: hashes:: Hash ;
50
50
use bitcoin:: script:: ScriptBuf ;
51
51
use bitcoin:: secp256k1:: PublicKey ;
52
- use bitcoin:: { OutPoint , Transaction } ;
52
+ use bitcoin:: { OutPoint , Transaction , TxOut } ;
53
53
use core:: ops:: Deref ;
54
54
55
55
#[ allow( unused_imports) ]
@@ -1524,6 +1524,37 @@ pub enum Event {
1524
1524
/// The features that this channel will operate with.
1525
1525
channel_type : ChannelTypeFeatures ,
1526
1526
} ,
1527
+ /// Used to indicate that a splice transaction for the given `channel_id` has failed.
1528
+ ///
1529
+ /// This event is emitted when a splice transaction construction or negotiation fails,
1530
+ /// allowing applications to handle the failure and potentially retry or take corrective action.
1531
+ ///
1532
+ /// # Failure Behavior and Persistence
1533
+ /// This event will eventually be replayed after failures-to-handle (i.e., the event handler
1534
+ /// returning `Err(ReplayEvent ())`) and will be persisted across restarts.
1535
+ SpliceFailed {
1536
+ /// The `channel_id` of the channel for which the splice failed.
1537
+ channel_id : ChannelId ,
1538
+ /// The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
1539
+ /// channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
1540
+ /// [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
1541
+ /// `user_channel_id` will be randomized for an inbound channel.
1542
+ ///
1543
+ /// [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
1544
+ /// [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
1545
+ /// [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
1546
+ user_channel_id : u128 ,
1547
+ /// The `node_id` of the channel counterparty.
1548
+ counterparty_node_id : PublicKey ,
1549
+ /// The outpoint of the channel's splice funding transaction, if one was created.
1550
+ funding_txo : Option < OutPoint > ,
1551
+ /// The features that this channel will operate with, if available.
1552
+ channel_type : Option < ChannelTypeFeatures > ,
1553
+ /// Input outpoints contributed to the splice transaction.
1554
+ contributed_inputs : Vec < OutPoint > ,
1555
+ /// Outputs contributed to the splice transaction.
1556
+ contributed_outputs : Vec < TxOut > ,
1557
+ } ,
1527
1558
/// Used to indicate to the user that they can abandon the funding transaction and recycle the
1528
1559
/// inputs for another purpose.
1529
1560
///
@@ -2254,6 +2285,26 @@ impl Writeable for Event {
2254
2285
( 9 , funding_txo, required) ,
2255
2286
} ) ;
2256
2287
} ,
2288
+ & Event :: SpliceFailed {
2289
+ ref channel_id,
2290
+ ref user_channel_id,
2291
+ ref counterparty_node_id,
2292
+ ref funding_txo,
2293
+ ref channel_type,
2294
+ ref contributed_inputs,
2295
+ ref contributed_outputs,
2296
+ } => {
2297
+ 52u8 . write ( writer) ?;
2298
+ write_tlv_fields ! ( writer, {
2299
+ ( 1 , channel_id, required) ,
2300
+ ( 3 , channel_type, option) ,
2301
+ ( 5 , user_channel_id, required) ,
2302
+ ( 7 , counterparty_node_id, required) ,
2303
+ ( 9 , funding_txo, option) ,
2304
+ ( 11 , * contributed_inputs, optional_vec) ,
2305
+ ( 13 , * contributed_outputs, optional_vec) ,
2306
+ } ) ;
2307
+ } ,
2257
2308
// Note that, going forward, all new events must only write data inside of
2258
2309
// `write_tlv_fields`. Versions 0.0.101+ will ignore odd-numbered events that write
2259
2310
// data via `write_tlv_fields`.
@@ -2856,6 +2907,30 @@ impl MaybeReadable for Event {
2856
2907
} ;
2857
2908
f ( )
2858
2909
} ,
2910
+ 52u8 => {
2911
+ let mut f = || {
2912
+ _init_and_read_len_prefixed_tlv_fields ! ( reader, {
2913
+ ( 1 , channel_id, required) ,
2914
+ ( 3 , channel_type, option) ,
2915
+ ( 5 , user_channel_id, required) ,
2916
+ ( 7 , counterparty_node_id, required) ,
2917
+ ( 9 , funding_txo, option) ,
2918
+ ( 11 , contributed_inputs, optional_vec) ,
2919
+ ( 13 , contributed_outputs, optional_vec) ,
2920
+ } ) ;
2921
+
2922
+ Ok ( Some ( Event :: SpliceFailed {
2923
+ channel_id : channel_id. 0 . unwrap ( ) ,
2924
+ user_channel_id : user_channel_id. 0 . unwrap ( ) ,
2925
+ counterparty_node_id : counterparty_node_id. 0 . unwrap ( ) ,
2926
+ funding_txo,
2927
+ channel_type,
2928
+ contributed_inputs : contributed_inputs. unwrap_or_default ( ) ,
2929
+ contributed_outputs : contributed_outputs. unwrap_or_default ( ) ,
2930
+ } ) )
2931
+ } ;
2932
+ f ( )
2933
+ } ,
2859
2934
// Versions prior to 0.0.100 did not ignore odd types, instead returning InvalidValue.
2860
2935
// Version 0.0.100 failed to properly ignore odd types, possibly resulting in corrupt
2861
2936
// reads.
0 commit comments