@@ -927,16 +927,28 @@ pub struct ChannelReestablish {
927
927
/// * `channel_reestablish`-sending node: https:///github.com/lightning/bolts/blob/247e83d/02-peer-protocol.md?plain=1#L2466-L2470
928
928
/// * `channel_reestablish`-receiving node: https:///github.com/lightning/bolts/blob/247e83d/02-peer-protocol.md?plain=1#L2520-L2531
929
929
pub next_funding_txid : Option < Txid > ,
930
- /// The last funding txid received by the sending node, which may be:
931
- /// - the txid of the last `splice_locked` it received, otherwise
932
- /// - the txid of the funding transaction if it received `channel_ready`, or else
933
- /// - `None` if it has never received `channel_ready` or `splice_locked`
934
- pub your_last_funding_locked_txid : Option < Txid > ,
935
930
/// The last funding txid sent by the sending node, which may be:
936
931
/// - the txid of the last `splice_locked` it sent, otherwise
937
932
/// - the txid of the funding transaction if it sent `channel_ready`, or else
938
933
/// - `None` if it has never sent `channel_ready` or `splice_locked`
939
- pub my_current_funding_locked_txid : Option < Txid > ,
934
+ ///
935
+ /// Also contains a bitfield indicating which messages should be retransmitted.
936
+ pub my_current_funding_locked : Option < FundingLocked > ,
937
+ }
938
+
939
+ /// Information exchanged during channel reestablishment about the last funding locked.
940
+ #[ derive( Clone , Debug , Hash , PartialEq , Eq ) ]
941
+ pub struct FundingLocked {
942
+ /// The last txid sent by the sending node, which may be either from the last `splice_locked` or
943
+ /// for the initial funding transaction if it sent `channel_ready`.
944
+ pub txid : Txid ,
945
+
946
+ /// A bitfield indicating which messages should be retransmitted by the receiving node.
947
+ ///
948
+ /// | Bit Position | Name |
949
+ /// | ------------- | --------------------------|
950
+ /// | 0 | `announcement_signatures` |
951
+ pub retransmit_flags : u8 ,
940
952
}
941
953
942
954
/// An [`announcement_signatures`] message to be sent to or received from a peer.
@@ -2821,8 +2833,12 @@ impl_writeable_msg!(ChannelReestablish, {
2821
2833
my_current_per_commitment_point,
2822
2834
} , {
2823
2835
( 0 , next_funding_txid, option) ,
2824
- ( 1 , your_last_funding_locked_txid, option) ,
2825
- ( 3 , my_current_funding_locked_txid, option) ,
2836
+ ( 5 , my_current_funding_locked, option) ,
2837
+ } ) ;
2838
+
2839
+ impl_writeable ! ( FundingLocked , {
2840
+ txid,
2841
+ retransmit_flags
2826
2842
} ) ;
2827
2843
2828
2844
impl_writeable_msg ! ( ClosingSigned ,
@@ -4295,8 +4311,7 @@ mod tests {
4295
4311
your_last_per_commitment_secret : [ 9 ; 32 ] ,
4296
4312
my_current_per_commitment_point : public_key,
4297
4313
next_funding_txid : None ,
4298
- your_last_funding_locked_txid : None ,
4299
- my_current_funding_locked_txid : None ,
4314
+ my_current_funding_locked : None ,
4300
4315
} ;
4301
4316
4302
4317
let encoded_value = cr. encode ( ) ;
@@ -4348,8 +4363,7 @@ mod tests {
4348
4363
] )
4349
4364
. unwrap ( ) ,
4350
4365
) ) ,
4351
- your_last_funding_locked_txid : None ,
4352
- my_current_funding_locked_txid : None ,
4366
+ my_current_funding_locked : None ,
4353
4367
} ;
4354
4368
4355
4369
let encoded_value = cr. encode ( ) ;
@@ -4399,20 +4413,16 @@ mod tests {
4399
4413
your_last_per_commitment_secret : [ 9 ; 32 ] ,
4400
4414
my_current_per_commitment_point : public_key,
4401
4415
next_funding_txid : None ,
4402
- your_last_funding_locked_txid : Some ( Txid :: from_raw_hash (
4403
- bitcoin:: hashes:: Hash :: from_slice ( & [
4404
- 48 , 167 , 250 , 69 , 152 , 48 , 103 , 172 , 164 , 99 , 59 , 19 , 23 , 11 , 92 , 84 , 15 , 80 ,
4405
- 4 , 12 , 98 , 82 , 75 , 31 , 201 , 11 , 91 , 23 , 98 , 23 , 53 , 124 ,
4406
- ] )
4407
- . unwrap ( ) ,
4408
- ) ) ,
4409
- my_current_funding_locked_txid : Some ( Txid :: from_raw_hash (
4410
- bitcoin:: hashes:: Hash :: from_slice ( & [
4411
- 21 , 167 , 250 , 69 , 152 , 48 , 103 , 172 , 164 , 99 , 59 , 19 , 23 , 11 , 92 , 84 , 15 , 80 ,
4412
- 4 , 12 , 98 , 82 , 75 , 31 , 201 , 11 , 91 , 23 , 98 , 23 , 53 , 124 ,
4413
- ] )
4414
- . unwrap ( ) ,
4415
- ) ) ,
4416
+ my_current_funding_locked : Some ( msgs:: FundingLocked {
4417
+ txid : Txid :: from_raw_hash (
4418
+ bitcoin:: hashes:: Hash :: from_slice ( & [
4419
+ 21 , 167 , 250 , 69 , 152 , 48 , 103 , 172 , 164 , 99 , 59 , 19 , 23 , 11 , 92 , 84 , 15 ,
4420
+ 80 , 4 , 12 , 98 , 82 , 75 , 31 , 201 , 11 , 91 , 23 , 98 , 23 , 53 , 124 ,
4421
+ ] )
4422
+ . unwrap ( ) ,
4423
+ ) ,
4424
+ retransmit_flags : 1 ,
4425
+ } ) ,
4416
4426
} ;
4417
4427
4418
4428
let encoded_value = cr. encode ( ) ;
@@ -4428,14 +4438,10 @@ mod tests {
4428
4438
3 , 27 , 132 , 197 , 86 , 123 , 18 , 100 , 64 , 153 , 93 , 62 , 213 , 170 , 186 , 5 , 101 , 215 , 30 ,
4429
4439
24 , 52 , 96 , 72 , 25 , 255 , 156 , 23 , 245 , 233 , 213 , 221 , 7 ,
4430
4440
143 , // my_current_per_commitment_point
4431
- 1 , // Type (your_last_funding_locked_txid)
4432
- 32 , // Length
4433
- 48 , 167 , 250 , 69 , 152 , 48 , 103 , 172 , 164 , 99 , 59 , 19 , 23 , 11 , 92 , 84 , 15 , 80 , 4 ,
4434
- 12 , 98 , 82 , 75 , 31 , 201 , 11 , 91 , 23 , 98 , 23 , 53 , 124 , // Value
4435
- 3 , // Type (my_current_funding_locked_txid)
4436
- 32 , // Length
4441
+ 5 , // Type (my_current_funding_locked)
4442
+ 33 , // Length
4437
4443
21 , 167 , 250 , 69 , 152 , 48 , 103 , 172 , 164 , 99 , 59 , 19 , 23 , 11 , 92 , 84 , 15 , 80 , 4 ,
4438
- 12 , 98 , 82 , 75 , 31 , 201 , 11 , 91 , 23 , 98 , 23 , 53 , 124 , // Value
4444
+ 12 , 98 , 82 , 75 , 31 , 201 , 11 , 91 , 23 , 98 , 23 , 53 , 124 , 1 , // Value
4439
4445
]
4440
4446
) ;
4441
4447
}
0 commit comments