You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lightning/src/ln/functional_tests.rs
+173-1Lines changed: 173 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ use ln::channel::{COMMITMENT_TX_BASE_WEIGHT, COMMITMENT_TX_WEIGHT_PER_HTLC};
22
22
use ln::channelmanager::{ChannelManager,ChannelManagerReadArgs,PaymentId,RAACommitmentOrder,PaymentSendFailure,BREAKDOWN_TIMEOUT,MIN_CLTV_EXPIRY_DELTA};
23
23
use ln::channel::{Channel,ChannelError};
24
24
use ln::{chan_utils, onion_utils};
25
-
use ln::chan_utils::{HTLC_SUCCESS_TX_WEIGHT,HTLCOutputInCommitment};
25
+
use ln::chan_utils::{HTLC_SUCCESS_TX_WEIGHT,HTLC_TIMEOUT_TX_WEIGHT,HTLCOutputInCommitment};
26
26
use routing::network_graph::{NetworkUpdate,RoutingFees};
27
27
use routing::router::{Payee,Route,RouteHop,RouteHint,RouteHintHop,RouteParameters, find_route, get_route};
28
28
use ln::features::{ChannelFeatures,InitFeatures,InvoiceFeatures,NodeFeatures};
let dust_outbound_overflow = dust_outbound_htlc_on_holder_tx_msat *(dust_outbound_htlc_on_holder_tx + 1);
9322
+
let dust_inbound_overflow = dust_inbound_htlc_on_holder_tx_msat * dust_inbound_htlc_on_holder_tx + dust_outbound_htlc_on_holder_tx_msat;
9323
+
unwrap_send_err!(nodes[0].node.send_payment(&route, payment_hash,&Some(payment_secret)),true,APIError::ChannelUnavailable{ ref err }, assert_eq!(err,&format!("Cannot send value that would put our exposure to dust HTLCs at {} over the limit {} on holder commitment tx",if dust_outbound_balance { dust_outbound_overflow } else { dust_inbound_overflow }, config.channel_options.max_dust_htlc_exposure_msat)));
9324
+
}else{
9325
+
unwrap_send_err!(nodes[0].node.send_payment(&route, payment_hash,&Some(payment_secret)),true,APIError::ChannelUnavailable{ ref err }, assert_eq!(err,&format!("Cannot send value that would put our exposure to dust HTLCs at {} over the limit {} on counterparty commitment tx", dust_overflow, config.channel_options.max_dust_htlc_exposure_msat)));
let dust_inbound_overflow = dust_inbound_htlc_on_holder_tx_msat *(dust_inbound_htlc_on_holder_tx + 1);
9339
+
let dust_outbound_overflow = dust_outbound_htlc_on_holder_tx_msat * dust_outbound_htlc_on_holder_tx + dust_inbound_htlc_on_holder_tx_msat;
9340
+
nodes[0].logger.assert_log("lightning::ln::channel".to_string(),format!("Cannot accept value that would put our exposure to dust HTLCs at {} over the limit {} on holder commitment tx",if dust_outbound_balance { dust_outbound_overflow } else { dust_inbound_overflow }, config.channel_options.max_dust_htlc_exposure_msat),1);
9341
+
}else{
9342
+
// Outbound dust balance: 5200 sats
9343
+
nodes[0].logger.assert_log("lightning::ln::channel".to_string(),format!("Cannot accept value that would put our exposure to dust HTLCs at {} over the limit {} on counterparty commitment tx", dust_overflow, config.channel_options.max_dust_htlc_exposure_msat),1);
nodes[0].logger.assert_log_contains("lightning::ln::channel".to_string(),"Cannot afford to send new feerate at 2530 without infringing max dust htlc exposure".to_string(),1);
9355
+
}
9356
+
9357
+
let _ = nodes[0].node.get_and_clear_pending_msg_events();
0 commit comments