@@ -4310,6 +4310,11 @@ impl<Signer: Sign> Channel<Signer> {
4310
4310
self . counterparty_htlc_minimum_msat
4311
4311
}
4312
4312
4313
+ /// Allowed in any state (including after shutdown), but will return none before TheirInitSent
4314
+ pub fn get_counterparty_htlc_maximum_msat ( & self ) -> Option < u64 > {
4315
+ self . get_htlc_maximum_msat ( self . counterparty_max_htlc_value_in_flight_msat )
4316
+ }
4317
+
4313
4318
fn get_htlc_maximum_msat ( & self , party_max_htlc_value_in_flight_msat : u64 ) -> Option < u64 > {
4314
4319
self . counterparty_selected_channel_reserve_satoshis . map ( |counterparty_reserve| {
4315
4320
let holder_reserve = self . holder_selected_channel_reserve_satoshis ;
@@ -5385,16 +5390,12 @@ impl<Signer: Sign> Channel<Signer> {
5385
5390
if msg. contents . htlc_minimum_msat >= self . channel_value_satoshis * 1000 {
5386
5391
return Err ( ChannelError :: Close ( "Minimum htlc value is greater than channel value" . to_string ( ) ) ) ;
5387
5392
}
5388
- let outbound_htlc_maximum_msat = match msg. contents . htlc_maximum_msat {
5389
- OptionalField :: Present ( htcl_max) => Some ( htcl_max) ,
5390
- OptionalField :: Absent => None
5391
- } ;
5392
5393
self . counterparty_forwarding_info = Some ( CounterpartyForwardingInfo {
5393
5394
fee_base_msat : msg. contents . fee_base_msat ,
5394
5395
fee_proportional_millionths : msg. contents . fee_proportional_millionths ,
5395
5396
cltv_expiry_delta : msg. contents . cltv_expiry_delta ,
5396
- outbound_htlc_minimum_msat : Some ( msg . contents . htlc_minimum_msat ) ,
5397
- outbound_htlc_maximum_msat,
5397
+ outbound_htlc_minimum_msat : Some ( self . get_counterparty_htlc_minimum_msat ( ) ) ,
5398
+ outbound_htlc_maximum_msat : self . get_counterparty_htlc_maximum_msat ( ) ,
5398
5399
} ) ;
5399
5400
5400
5401
Ok ( ( ) )
0 commit comments