@@ -1278,12 +1278,20 @@ pub trait ChannelMessageHandler : MessageSendEventsProvider {
1278
1278
/// Handle an incoming `channel_ready` message from the given peer.
1279
1279
fn handle_channel_ready ( & self , their_node_id : & PublicKey , msg : & ChannelReady ) ;
1280
1280
1281
- // Channl close:
1281
+ // Channel close:
1282
1282
/// Handle an incoming `shutdown` message from the given peer.
1283
1283
fn handle_shutdown ( & self , their_node_id : & PublicKey , msg : & Shutdown ) ;
1284
1284
/// Handle an incoming `closing_signed` message from the given peer.
1285
1285
fn handle_closing_signed ( & self , their_node_id : & PublicKey , msg : & ClosingSigned ) ;
1286
1286
1287
+ // Splicing
1288
+ /// Handle an incoming `splice` message from the given peer.
1289
+ fn handle_splice ( & self , their_node_id : & PublicKey , msg : & Splice ) ;
1290
+ /// Handle an incoming `splice_ack` message from the given peer.
1291
+ fn handle_splice_ack ( & self , their_node_id : & PublicKey , msg : & SpliceAck ) ;
1292
+ /// Handle an incoming `splice_locked` message from the given peer.
1293
+ fn handle_splice_locked ( & self , their_node_id : & PublicKey , msg : & SpliceLocked ) ;
1294
+
1287
1295
// Interactive channel construction
1288
1296
/// Handle an incoming `tx_add_input message` from the given peer.
1289
1297
fn handle_tx_add_input ( & self , their_node_id : & PublicKey , msg : & TxAddInput ) ;
@@ -1662,6 +1670,26 @@ impl_writeable_msg!(AcceptChannelV2, {
1662
1670
( 2 , require_confirmed_inputs, option) ,
1663
1671
} ) ;
1664
1672
1673
+ impl_writeable_msg ! ( Splice , {
1674
+ chain_hash,
1675
+ channel_id,
1676
+ funding_satoshis,
1677
+ funding_feerate_perkw,
1678
+ locktime,
1679
+ funding_pubkey,
1680
+ } , { } ) ;
1681
+
1682
+ impl_writeable_msg ! ( SpliceAck , {
1683
+ chain_hash,
1684
+ channel_id,
1685
+ funding_satoshis,
1686
+ funding_pubkey,
1687
+ } , { } ) ;
1688
+
1689
+ impl_writeable_msg ! ( SpliceLocked , {
1690
+ channel_id,
1691
+ } , { } ) ;
1692
+
1665
1693
impl_writeable_msg ! ( TxAddInput , {
1666
1694
channel_id,
1667
1695
serial_id,
@@ -3164,6 +3192,50 @@ mod tests {
3164
3192
assert_eq ! ( encoded_value, target_value) ;
3165
3193
}
3166
3194
3195
+ #[ test]
3196
+ fn encoding_splice ( ) {
3197
+ let secp_ctx = Secp256k1 :: new ( ) ;
3198
+ let ( _, pubkey_1, ) = get_keys_from ! ( "0101010101010101010101010101010101010101010101010101010101010101" , secp_ctx) ;
3199
+ let splice = msgs:: Splice {
3200
+ chain_hash : BlockHash :: from_hex ( "6fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000" ) . unwrap ( ) ,
3201
+ channel_id : ChannelId :: from_bytes ( [ 2 ; 32 ] ) ,
3202
+ funding_satoshis : 123456 ,
3203
+ funding_feerate_perkw : 2000 ,
3204
+ locktime : 0 ,
3205
+ funding_pubkey : pubkey_1,
3206
+ } ;
3207
+ let encoded_value = splice. encode ( ) ;
3208
+ let target_value = hex:: decode ( "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f0202020202020202020202020202020202020202020202020202020202020202000000000001e240000007d000000000031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f" ) . unwrap ( ) ;
3209
+ assert_eq ! ( encoded_value, target_value) ;
3210
+ }
3211
+
3212
+ #[ test]
3213
+ fn encoding_splice_ack ( ) {
3214
+ let secp_ctx = Secp256k1 :: new ( ) ;
3215
+ let ( _, pubkey_1, ) = get_keys_from ! ( "0101010101010101010101010101010101010101010101010101010101010101" , secp_ctx) ;
3216
+ let splice = msgs:: SpliceAck {
3217
+ chain_hash : BlockHash :: from_hex ( "6fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000" ) . unwrap ( ) ,
3218
+ channel_id : ChannelId :: from_bytes ( [ 2 ; 32 ] ) ,
3219
+ funding_satoshis : 123456 ,
3220
+ funding_pubkey : pubkey_1,
3221
+ } ;
3222
+ let encoded_value = splice. encode ( ) ;
3223
+ let target_value = hex:: decode ( "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f0202020202020202020202020202020202020202020202020202020202020202000000000001e240031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f" ) . unwrap ( ) ;
3224
+ assert_eq ! ( encoded_value, target_value) ;
3225
+ }
3226
+
3227
+ #[ test]
3228
+ fn encoding_splice_locked ( ) {
3229
+ let secp_ctx = Secp256k1 :: new ( ) ;
3230
+ let ( _, pubkey_1, ) = get_keys_from ! ( "0101010101010101010101010101010101010101010101010101010101010101" , secp_ctx) ;
3231
+ let splice = msgs:: SpliceLocked {
3232
+ channel_id : ChannelId :: from_bytes ( [ 2 ; 32 ] ) ,
3233
+ } ;
3234
+ let encoded_value = splice. encode ( ) ;
3235
+ let target_value = hex:: decode ( "0202020202020202020202020202020202020202020202020202020202020202" ) . unwrap ( ) ;
3236
+ assert_eq ! ( encoded_value, target_value) ;
3237
+ }
3238
+
3167
3239
#[ test]
3168
3240
fn encoding_tx_add_input ( ) {
3169
3241
let tx_add_input = msgs:: TxAddInput {
0 commit comments