@@ -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) ]
@@ -1436,6 +1436,37 @@ pub enum Event {
1436
1436
/// The features that this channel will operate with.
1437
1437
channel_type : ChannelTypeFeatures ,
1438
1438
} ,
1439
+ /// Used to indicate that a splice transaction for the given `channel_id` has failed.
1440
+ ///
1441
+ /// This event is emitted when a splice transaction construction or negotiation fails,
1442
+ /// allowing applications to handle the failure and potentially retry or take corrective action.
1443
+ ///
1444
+ /// # Failure Behavior and Persistence
1445
+ /// This event will eventually be replayed after failures-to-handle (i.e., the event handler
1446
+ /// returning `Err(ReplayEvent ())`) and will be persisted across restarts.
1447
+ SpliceFailed {
1448
+ /// The `channel_id` of the channel for which the splice failed.
1449
+ channel_id : ChannelId ,
1450
+ /// The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
1451
+ /// channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
1452
+ /// [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
1453
+ /// `user_channel_id` will be randomized for an inbound channel.
1454
+ ///
1455
+ /// [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
1456
+ /// [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
1457
+ /// [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
1458
+ user_channel_id : u128 ,
1459
+ /// The `node_id` of the channel counterparty.
1460
+ counterparty_node_id : PublicKey ,
1461
+ /// The outpoint of the channel's splice funding transaction, if one was created.
1462
+ funding_txo : Option < OutPoint > ,
1463
+ /// The features that this channel will operate with, if available.
1464
+ channel_type : Option < ChannelTypeFeatures > ,
1465
+ /// Input outpoints contributed to the splice transaction.
1466
+ contributed_inputs : Vec < OutPoint > ,
1467
+ /// Outputs contributed to the splice transaction.
1468
+ contributed_outputs : Vec < TxOut > ,
1469
+ } ,
1439
1470
/// Used to indicate that a channel with the given `channel_id` is ready to be used. This event
1440
1471
/// is emitted when
1441
1472
/// - the initial funding transaction has been confirmed on-chain to an acceptable depth
@@ -2198,6 +2229,26 @@ impl Writeable for Event {
2198
2229
( 9 , funding_txo, required) ,
2199
2230
} ) ;
2200
2231
} ,
2232
+ & Event :: SpliceFailed {
2233
+ ref channel_id,
2234
+ ref user_channel_id,
2235
+ ref counterparty_node_id,
2236
+ ref funding_txo,
2237
+ ref channel_type,
2238
+ ref contributed_inputs,
2239
+ ref contributed_outputs,
2240
+ } => {
2241
+ 52u8 . write ( writer) ?;
2242
+ write_tlv_fields ! ( writer, {
2243
+ ( 1 , channel_id, required) ,
2244
+ ( 3 , channel_type, option) ,
2245
+ ( 5 , user_channel_id, required) ,
2246
+ ( 7 , counterparty_node_id, required) ,
2247
+ ( 9 , funding_txo, option) ,
2248
+ ( 11 , * contributed_inputs, optional_vec) ,
2249
+ ( 13 , * contributed_outputs, optional_vec) ,
2250
+ } ) ;
2251
+ } ,
2201
2252
& Event :: ConnectionNeeded { .. } => {
2202
2253
35u8 . write ( writer) ?;
2203
2254
// Never write ConnectionNeeded events as buffered onion messages aren't serialized.
@@ -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