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
if $htlc.is_dust(local, feerate_per_kw, broadcaster_dust_limit_sat, funding.get_channel_type()) {
4599
-
log_trace!(logger, " ...including {} {} dust HTLC {} (hash {}) with value {} due to dust limit", if $outbound { "outbound" } else { "inbound" }, $htlc.state, $htlc.htlc_id, $htlc.payment_hash, $htlc.amount_msat);
4600
-
} else {
4601
-
log_trace!(logger, " ...including {} {} HTLC {} (hash {}) with value {}", if $outbound { "outbound" } else { "inbound" }, $htlc.state, $htlc.htlc_id, $htlc.payment_hash, $htlc.amount_msat);
4602
-
nondust_htlcs.push(htlc_in_tx);
4603
-
}
4591
+
htlcs_included.push((htlc_in_tx, $source));
4604
4592
}
4605
4593
}
4606
4594
@@ -4609,11 +4597,13 @@ where
4609
4597
4610
4598
for htlc in self.pending_inbound_htlcs.iter() {
4611
4599
if htlc.state.included_in_commitment(generated_by_local) {
4600
+
log_trace!(logger, " ...including inbound {} HTLC {} (hash {}) with value {}", htlc.state, htlc.htlc_id, htlc.payment_hash, htlc.amount_msat);
4612
4601
add_htlc_output!(htlc, false, None);
4613
4602
} else {
4614
4603
log_trace!(logger, " ...not including inbound HTLC {} (hash {}) with value {} due to state ({})", htlc.htlc_id, htlc.payment_hash, htlc.amount_msat, htlc.state);
4615
4604
if let Some(preimage) = htlc.state.preimage() {
4616
4605
inbound_htlc_preimages.push(preimage);
4606
+
value_to_self_msat_offset += htlc.amount_msat as i64;
4617
4607
}
4618
4608
}
4619
4609
};
@@ -4623,53 +4613,37 @@ where
4623
4613
outbound_htlc_preimages.push(preimage);
4624
4614
}
4625
4615
if htlc.state.included_in_commitment(generated_by_local) {
4616
+
log_trace!(logger, " ...including outbound {} HTLC {} (hash {}) with value {}", htlc.state, htlc.htlc_id, htlc.payment_hash, htlc.amount_msat);
4626
4617
add_htlc_output!(htlc, true, Some(&htlc.source));
4627
4618
} else {
4628
4619
log_trace!(logger, " ...not including outbound HTLC {} (hash {}) with value {} due to state ({})", htlc.htlc_id, htlc.payment_hash, htlc.amount_msat, htlc.state);
4620
+
if htlc.state.preimage().is_some() {
4621
+
value_to_self_msat_offset -= htlc.amount_msat as i64;
4622
+
}
4629
4623
}
4630
4624
};
4631
4625
4632
-
// We MUST use saturating subs here, as the funder's balance is not guaranteed to be greater
4633
-
// than or equal to the sum of `total_fee_sat` and `total_anchors_sat`.
4626
+
// # Panics
4634
4627
//
4635
-
// This is because when the remote party sends an `update_fee` message, we build the new
4636
-
// commitment transaction *before* checking whether the remote party's balance is enough to
4637
-
// cover the total fee and the anchors.
4628
+
// While we expect `value_to_self_msat_offset` to be negative in some cases, the local
4629
+
// balance MUST remain greater than or equal to 0.
4638
4630
4639
-
let (value_to_self, value_to_remote) = if funding.is_outbound() {
0 commit comments