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