@@ -281,6 +281,12 @@ impl HTLCCandidate {
281
281
}
282
282
}
283
283
284
+ pub struct CounterpartyForwardingInfo {
285
+ pub fee_base_msat : u32 ,
286
+ pub fee_proportional_millionths : u32 ,
287
+ pub cltv_expiry_delta : u16 ,
288
+ }
289
+
284
290
// TODO: We should refactor this to be an Inbound/OutboundChannel until initial setup handshaking
285
291
// has been completed, and then turn into a Channel to get compiler-time enforcement of things like
286
292
// calling channel_id() before we're set up or things like get_outbound_funding_signed on an
@@ -391,6 +397,8 @@ pub(super) struct Channel<Signer: Sign> {
391
397
//implied by OUR_MAX_HTLCS: max_accepted_htlcs: u16,
392
398
minimum_depth : u32 ,
393
399
400
+ counterparty_forwarding_info : Option < CounterpartyForwardingInfo > ,
401
+
394
402
pub ( crate ) channel_transaction_parameters : ChannelTransactionParameters ,
395
403
396
404
counterparty_cur_commitment_point : Option < PublicKey > ,
@@ -577,6 +585,8 @@ impl<Signer: Sign> Channel<Signer> {
577
585
counterparty_max_accepted_htlcs : 0 ,
578
586
minimum_depth : 0 , // Filled in in accept_channel
579
587
588
+ counterparty_forwarding_info : None ,
589
+
580
590
channel_transaction_parameters : ChannelTransactionParameters {
581
591
holder_pubkeys : pubkeys,
582
592
holder_selected_contest_delay : config. own_channel_config . our_to_self_delay ,
@@ -813,6 +823,8 @@ impl<Signer: Sign> Channel<Signer> {
813
823
counterparty_max_accepted_htlcs : msg. max_accepted_htlcs ,
814
824
minimum_depth : config. own_channel_config . minimum_depth ,
815
825
826
+ counterparty_forwarding_info : None ,
827
+
816
828
channel_transaction_parameters : ChannelTransactionParameters {
817
829
holder_pubkeys : pubkeys,
818
830
holder_selected_contest_delay : config. own_channel_config . our_to_self_delay ,
@@ -4437,6 +4449,16 @@ impl<Signer: Sign> Writeable for Channel<Signer> {
4437
4449
self . counterparty_max_accepted_htlcs . write ( writer) ?;
4438
4450
self . minimum_depth . write ( writer) ?;
4439
4451
4452
+ match & self . counterparty_forwarding_info {
4453
+ Some ( info) => {
4454
+ 1u8 . write ( writer) ?;
4455
+ info. fee_base_msat . write ( writer) ?;
4456
+ info. fee_proportional_millionths . write ( writer) ?;
4457
+ info. cltv_expiry_delta . write ( writer) ?;
4458
+ } ,
4459
+ None => 0u8 . write ( writer) ?
4460
+ }
4461
+
4440
4462
self . channel_transaction_parameters . write ( writer) ?;
4441
4463
self . counterparty_cur_commitment_point . write ( writer) ?;
4442
4464
@@ -4597,6 +4619,16 @@ impl<'a, Signer: Sign, K: Deref> ReadableArgs<&'a K> for Channel<Signer>
4597
4619
let counterparty_max_accepted_htlcs = Readable :: read ( reader) ?;
4598
4620
let minimum_depth = Readable :: read ( reader) ?;
4599
4621
4622
+ let counterparty_forwarding_info = match <u8 as Readable >:: read ( reader) ? {
4623
+ 0 => None ,
4624
+ 1 => Some ( CounterpartyForwardingInfo {
4625
+ fee_base_msat : Readable :: read ( reader) ?,
4626
+ fee_proportional_millionths : Readable :: read ( reader) ?,
4627
+ cltv_expiry_delta : Readable :: read ( reader) ?,
4628
+ } ) ,
4629
+ _ => return Err ( DecodeError :: InvalidValue ) ,
4630
+ } ;
4631
+
4600
4632
let channel_parameters = Readable :: read ( reader) ?;
4601
4633
let counterparty_cur_commitment_point = Readable :: read ( reader) ?;
4602
4634
@@ -4667,6 +4699,8 @@ impl<'a, Signer: Sign, K: Deref> ReadableArgs<&'a K> for Channel<Signer>
4667
4699
counterparty_max_accepted_htlcs,
4668
4700
minimum_depth,
4669
4701
4702
+ counterparty_forwarding_info,
4703
+
4670
4704
channel_transaction_parameters : channel_parameters,
4671
4705
counterparty_cur_commitment_point,
4672
4706
0 commit comments