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