File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -1012,8 +1012,10 @@ impl Channel {
1012
1012
if htlc_inbound_value_msat + msg. amount_msat > Channel :: get_our_max_htlc_value_in_flight_msat ( self . channel_value_satoshis ) {
1013
1013
return Err ( HandleError { err : "Remote HTLC add would put them over their max HTLC value in flight" , msg : None } ) ;
1014
1014
}
1015
- // Check our_channel_reserve_satoshis:
1016
- if htlc_inbound_value_msat + htlc_outbound_value_msat + msg. amount_msat > ( self . channel_value_satoshis - Channel :: get_our_channel_reserve_satoshis ( self . channel_value_satoshis ) ) * 1000 {
1015
+ // Check our_channel_reserve_satoshis (we're getting paid, so they have to at least meet
1016
+ // the reserve_satoshis we told them to always have as direct payment so that they lose
1017
+ // something if we punish them for broadcasting an old state).
1018
+ if htlc_inbound_value_msat + htlc_outbound_value_msat + msg. amount_msat + self . value_to_self_msat > ( self . channel_value_satoshis - Channel :: get_our_channel_reserve_satoshis ( self . channel_value_satoshis ) ) * 1000 {
1017
1019
return Err ( HandleError { err : "Remote HTLC add would put them over their reserve value" , msg : None } ) ;
1018
1020
}
1019
1021
if self . next_remote_htlc_id != msg. htlc_id {
@@ -1591,7 +1593,7 @@ impl Channel {
1591
1593
return Err ( HandleError { err : "Cannot send value that would put us over our max HTLC value in flight" , msg : None } ) ;
1592
1594
}
1593
1595
// Check their_channel_reserve_satoshis:
1594
- if htlc_outbound_value_msat + amount_msat > ( self . channel_value_satoshis - self . their_channel_reserve_satoshis ) * 1000 - htlc_inbound_value_msat {
1596
+ if htlc_inbound_value_msat + htlc_outbound_value_msat + amount_msat + ( self . channel_value_satoshis * 1000 - self . value_to_self_msat ) > ( self . channel_value_satoshis - self . their_channel_reserve_satoshis ) * 1000 {
1595
1597
return Err ( HandleError { err : "Cannot send value that would put us over our reserve value" , msg : None } ) ;
1596
1598
}
1597
1599
You can’t perform that action at this time.
0 commit comments