Skip to content

Commit 6400b71

Browse files
committed
DEBUGGING - DO NOT MERGE
1 parent 0bef7d8 commit 6400b71

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

lightning/src/ln/channel.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5222,7 +5222,7 @@ impl<Signer: Sign> Channel<Signer> {
52225222
}
52235223
// Check their_max_htlc_value_in_flight_msat
52245224
if outbound_stats.pending_htlcs_value_msat + amount_msat > self.counterparty_max_htlc_value_in_flight_msat {
5225-
return Err(ChannelError::Ignore(format!("Cannot send value that would put us over the max HTLC value in flight our peer will accept ({})", self.counterparty_max_htlc_value_in_flight_msat)));
5225+
return Err(ChannelError::Ignore(format!("Cannot send value that would put us over the max HTLC value in flight our peer will accept ({} + {} > {})", outbound_stats.pending_htlcs_value_msat, amount_msat, self.counterparty_max_htlc_value_in_flight_msat)));
52265226
}
52275227

52285228
let keys = self.build_holder_transaction_keys(self.cur_holder_commitment_transaction_number)?;

lightning/src/routing/router.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,7 @@ where L::Target: Logger {
934934
let doesnt_exceed_cltv_delta_limit = hop_total_cltv_delta <= max_total_cltv_expiry_delta;
935935

936936
let value_contribution_msat = cmp::min(available_value_contribution_msat, $next_hops_value_contribution);
937+
eprintln!("value_contribution_msat: {} = min(available_value_contribution_msat: {}, $next_hops_value_contribution: {})", value_contribution_msat, available_value_contribution_msat, $next_hops_value_contribution);
937938
// Includes paying fees for the use of the following channels.
938939
let amount_to_transfer_over_msat: u64 = match value_contribution_msat.checked_add($next_hops_fee_msat) {
939940
Some(result) => result,
@@ -955,7 +956,8 @@ where L::Target: Logger {
955956
// bother considering this channel. If retrying with recommended_value_msat may
956957
// allow us to hit the HTLC minimum limit, set htlc_minimum_limit so that we go
957958
// around again with a higher amount.
958-
if contributes_sufficient_value && doesnt_exceed_cltv_delta_limit && may_overpay_to_meet_path_minimum_msat {
959+
if value_contribution_msat == 0 {
960+
} else if contributes_sufficient_value && doesnt_exceed_cltv_delta_limit && may_overpay_to_meet_path_minimum_msat {
959961
hit_minimum_limit = true;
960962
} else if contributes_sufficient_value && doesnt_exceed_cltv_delta_limit && over_path_minimum_msat {
961963
// Note that low contribution here (limited by available_liquidity_msat)
@@ -1434,6 +1436,7 @@ where L::Target: Logger {
14341436
.entry((hop.candidate.short_channel_id(), *prev_hop < hop.node_id))
14351437
.and_modify(|used_liquidity_msat| *used_liquidity_msat += spent_on_hop_msat)
14361438
.or_insert(spent_on_hop_msat);
1439+
eprintln!("used_liquidity_msat: {}, spent_on_hop_msat: {}", used_liquidity_msat, spent_on_hop_msat);
14371440
if *used_liquidity_msat == hop.candidate.htlc_maximum_msat() {
14381441
// If this path used all of this channel's available liquidity, we know
14391442
// this path will not be selected again in the next loop iteration.

0 commit comments

Comments
 (0)