@@ -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) ]
@@ -1533,6 +1533,40 @@ pub enum Event {
1533
1533
/// features that the channel was opened with, but in the future splices may change them.
1534
1534
channel_type : ChannelTypeFeatures ,
1535
1535
} ,
1536
+ /// Used to indicate that a splice for the given `channel_id` has failed.
1537
+ ///
1538
+ /// This event may be emitted if a splice fails after it has been initiated but prior to signing
1539
+ /// any negotiated funding transaction.
1540
+ ///
1541
+ /// Any UTXOs contributed to be spent by the funding transaction may be reused and will be
1542
+ /// given in `contributed_inputs`.
1543
+ ///
1544
+ /// # Failure Behavior and Persistence
1545
+ /// This event will eventually be replayed after failures-to-handle (i.e., the event handler
1546
+ /// returning `Err(ReplayEvent ())`) and will be persisted across restarts.
1547
+ SpliceFailed {
1548
+ /// The `channel_id` of the channel for which the splice failed.
1549
+ channel_id : ChannelId ,
1550
+ /// The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
1551
+ /// channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
1552
+ /// [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
1553
+ /// `user_channel_id` will be randomized for an inbound channel.
1554
+ ///
1555
+ /// [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
1556
+ /// [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
1557
+ /// [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
1558
+ user_channel_id : u128 ,
1559
+ /// The `node_id` of the channel counterparty.
1560
+ counterparty_node_id : PublicKey ,
1561
+ /// The outpoint of the channel's splice funding transaction, if one was created.
1562
+ funding_txo : Option < OutPoint > ,
1563
+ /// The features that this channel will operate with, if available.
1564
+ channel_type : Option < ChannelTypeFeatures > ,
1565
+ /// UTXOs spent as inputs contributed to the splice transaction.
1566
+ contributed_inputs : Vec < OutPoint > ,
1567
+ /// Outputs contributed to the splice transaction.
1568
+ contributed_outputs : Vec < TxOut > ,
1569
+ } ,
1536
1570
/// Used to indicate to the user that they can abandon the funding transaction and recycle the
1537
1571
/// inputs for another purpose.
1538
1572
///
@@ -2275,6 +2309,26 @@ impl Writeable for Event {
2275
2309
( 9 , funding_txo, required) ,
2276
2310
} ) ;
2277
2311
} ,
2312
+ & Event :: SpliceFailed {
2313
+ ref channel_id,
2314
+ ref user_channel_id,
2315
+ ref counterparty_node_id,
2316
+ ref funding_txo,
2317
+ ref channel_type,
2318
+ ref contributed_inputs,
2319
+ ref contributed_outputs,
2320
+ } => {
2321
+ 52u8 . write ( writer) ?;
2322
+ write_tlv_fields ! ( writer, {
2323
+ ( 1 , channel_id, required) ,
2324
+ ( 3 , channel_type, option) ,
2325
+ ( 5 , user_channel_id, required) ,
2326
+ ( 7 , counterparty_node_id, required) ,
2327
+ ( 9 , funding_txo, option) ,
2328
+ ( 11 , * contributed_inputs, optional_vec) ,
2329
+ ( 13 , * contributed_outputs, optional_vec) ,
2330
+ } ) ;
2331
+ } ,
2278
2332
// Note that, going forward, all new events must only write data inside of
2279
2333
// `write_tlv_fields`. Versions 0.0.101+ will ignore odd-numbered events that write
2280
2334
// data via `write_tlv_fields`.
@@ -2877,6 +2931,30 @@ impl MaybeReadable for Event {
2877
2931
} ;
2878
2932
f ( )
2879
2933
} ,
2934
+ 52u8 => {
2935
+ let mut f = || {
2936
+ _init_and_read_len_prefixed_tlv_fields ! ( reader, {
2937
+ ( 1 , channel_id, required) ,
2938
+ ( 3 , channel_type, option) ,
2939
+ ( 5 , user_channel_id, required) ,
2940
+ ( 7 , counterparty_node_id, required) ,
2941
+ ( 9 , funding_txo, option) ,
2942
+ ( 11 , contributed_inputs, optional_vec) ,
2943
+ ( 13 , contributed_outputs, optional_vec) ,
2944
+ } ) ;
2945
+
2946
+ Ok ( Some ( Event :: SpliceFailed {
2947
+ channel_id : channel_id. 0 . unwrap ( ) ,
2948
+ user_channel_id : user_channel_id. 0 . unwrap ( ) ,
2949
+ counterparty_node_id : counterparty_node_id. 0 . unwrap ( ) ,
2950
+ funding_txo,
2951
+ channel_type,
2952
+ contributed_inputs : contributed_inputs. unwrap_or_default ( ) ,
2953
+ contributed_outputs : contributed_outputs. unwrap_or_default ( ) ,
2954
+ } ) )
2955
+ } ;
2956
+ f ( )
2957
+ } ,
2880
2958
// Versions prior to 0.0.100 did not ignore odd types, instead returning InvalidValue.
2881
2959
// Version 0.0.100 failed to properly ignore odd types, possibly resulting in corrupt
2882
2960
// reads.
0 commit comments