@@ -1278,12 +1278,20 @@ pub trait ChannelMessageHandler : MessageSendEventsProvider {
12781278 /// Handle an incoming `channel_ready` message from the given peer.
12791279 fn handle_channel_ready ( & self , their_node_id : & PublicKey , msg : & ChannelReady ) ;
12801280
1281- // Channl close:
1281+ // Channel close:
12821282 /// Handle an incoming `shutdown` message from the given peer.
12831283 fn handle_shutdown ( & self , their_node_id : & PublicKey , msg : & Shutdown ) ;
12841284 /// Handle an incoming `closing_signed` message from the given peer.
12851285 fn handle_closing_signed ( & self , their_node_id : & PublicKey , msg : & ClosingSigned ) ;
12861286
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+
12871295 // Interactive channel construction
12881296 /// Handle an incoming `tx_add_input message` from the given peer.
12891297 fn handle_tx_add_input ( & self , their_node_id : & PublicKey , msg : & TxAddInput ) ;
@@ -1662,6 +1670,26 @@ impl_writeable_msg!(AcceptChannelV2, {
16621670 ( 2 , require_confirmed_inputs, option) ,
16631671} ) ;
16641672
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+
16651693impl_writeable_msg ! ( TxAddInput , {
16661694 channel_id,
16671695 serial_id,
@@ -3164,6 +3192,50 @@ mod tests {
31643192 assert_eq ! ( encoded_value, target_value) ;
31653193 }
31663194
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+
31673239 #[ test]
31683240 fn encoding_tx_add_input ( ) {
31693241 let tx_add_input = msgs:: TxAddInput {
0 commit comments