@@ -543,6 +543,8 @@ pub struct TxSignatures {
543543 pub tx_hash : Txid ,
544544 /// The list of witnesses
545545 pub witnesses : Vec < Witness > ,
546+ /// Optional signature for the shared input -- the previous funding outpoint -- signed by both peers
547+ pub funding_outpoint_sig : Option < Signature > ,
546548}
547549
548550/// A tx_init_rbf message which initiates a replacement of the transaction after it's been
@@ -1460,10 +1462,13 @@ pub trait ChannelMessageHandler : MessageSendEventsProvider {
14601462
14611463 // Splicing
14621464 /// Handle an incoming `splice` message from the given peer.
1465+ #[ cfg( dual_funding) ]
14631466 fn handle_splice ( & self , their_node_id : & PublicKey , msg : & Splice ) ;
14641467 /// Handle an incoming `splice_ack` message from the given peer.
1468+ #[ cfg( dual_funding) ]
14651469 fn handle_splice_ack ( & self , their_node_id : & PublicKey , msg : & SpliceAck ) ;
14661470 /// Handle an incoming `splice_locked` message from the given peer.
1471+ #[ cfg( dual_funding) ]
14671472 fn handle_splice_locked ( & self , their_node_id : & PublicKey , msg : & SpliceLocked ) ;
14681473
14691474 // Interactive channel construction
@@ -2115,7 +2120,9 @@ impl_writeable_msg!(TxSignatures, {
21152120 channel_id,
21162121 tx_hash,
21172122 witnesses,
2118- } , { } ) ;
2123+ } , {
2124+ ( 0 , funding_outpoint_sig, option) ,
2125+ } ) ;
21192126
21202127impl_writeable_msg ! ( TxInitRbf , {
21212128 channel_id,
@@ -3952,6 +3959,10 @@ mod tests {
39523959
39533960 #[ test]
39543961 fn encoding_tx_signatures ( ) {
3962+ let secp_ctx = Secp256k1 :: new ( ) ;
3963+ let ( privkey_1, _) = get_keys_from ! ( "0101010101010101010101010101010101010101010101010101010101010101" , secp_ctx) ;
3964+ let sig_1 = get_sig_on ! ( privkey_1, secp_ctx, String :: from( "01010101010101010101010101010101" ) ) ;
3965+
39553966 let tx_signatures = msgs:: TxSignatures {
39563967 channel_id : ChannelId :: from_bytes ( [ 2 ; 32 ] ) ,
39573968 tx_hash : Txid :: from_str ( "c2d4449afa8d26140898dd54d3390b057ba2a5afcf03ba29d7dc0d8b9ffe966e" ) . unwrap ( ) ,
@@ -3963,6 +3974,7 @@ mod tests {
39633974 <Vec <u8 >>:: from_hex( "3045022100ee00dbf4a862463e837d7c08509de814d620e4d9830fa84818713e0fa358f145022021c3c7060c4d53fe84fd165d60208451108a778c13b92ca4c6bad439236126cc01" ) . unwrap( ) ,
39643975 <Vec <u8 >>:: from_hex( "028fbbf0b16f5ba5bcb5dd37cd4047ce6f726a21c06682f9ec2f52b057de1dbdb5" ) . unwrap( ) ] ) ,
39653976 ] ,
3977+ funding_outpoint_sig : Some ( sig_1) ,
39663978 } ;
39673979 let encoded_value = tx_signatures. encode ( ) ;
39683980 let mut target_value = <Vec < u8 > >:: from_hex ( "0202020202020202020202020202020202020202020202020202020202020202" ) . unwrap ( ) ; // channel_id
@@ -3982,6 +3994,8 @@ mod tests {
39823994 target_value. append ( & mut <Vec < u8 > >:: from_hex ( "3045022100ee00dbf4a862463e837d7c08509de814d620e4d9830fa84818713e0fa358f145022021c3c7060c4d53fe84fd165d60208451108a778c13b92ca4c6bad439236126cc01" ) . unwrap ( ) ) ;
39833995 target_value. append ( & mut <Vec < u8 > >:: from_hex ( "21" ) . unwrap ( ) ) ; // len of witness element data (VarInt)
39843996 target_value. append ( & mut <Vec < u8 > >:: from_hex ( "028fbbf0b16f5ba5bcb5dd37cd4047ce6f726a21c06682f9ec2f52b057de1dbdb5" ) . unwrap ( ) ) ;
3997+ target_value. append ( & mut <Vec < u8 > >:: from_hex ( "0040" ) . unwrap ( ) ) ; // type and len (64)
3998+ target_value. append ( & mut <Vec < u8 > >:: from_hex ( "d977cb9b53d93a6ff64bb5f1e158b4094b66e798fb12911168a3ccdf80a83096340a6a95da0ae8d9f776528eecdbb747eb6b545495a4319ed5378e35b21e073a" ) . unwrap ( ) ) ;
39853999 assert_eq ! ( encoded_value, target_value) ;
39864000 }
39874001
0 commit comments