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.state.included_in_commitment(generated_by_local) {
4003
+
log_trace!(logger, " ...including inbound {} HTLC {} (hash {}) with value {}", htlc.state, htlc.htlc_id, htlc.payment_hash, htlc.amount_msat);
4015
4004
add_htlc_output!(htlc, false, None);
4016
4005
} else {
4017
4006
log_trace!(logger, " ...not including inbound HTLC {} (hash {}) with value {} due to state ({})", htlc.htlc_id, htlc.payment_hash, htlc.amount_msat, htlc.state);
4018
4007
if let Some(preimage) = htlc.state.preimage() {
4019
4008
inbound_htlc_preimages.push(preimage);
4009
+
value_to_self_msat_offset += htlc.amount_msat as i64;
if htlc.state.included_in_commitment(generated_by_local) {
4019
+
log_trace!(logger, " ...including outbound {} HTLC {} (hash {}) with value {}", htlc.state, htlc.htlc_id, htlc.payment_hash, htlc.amount_msat);
4029
4020
add_htlc_output!(htlc, true, Some(&htlc.source));
4030
4021
} else {
4031
4022
log_trace!(logger, " ...not including outbound HTLC {} (hash {}) with value {} due to state ({})", htlc.htlc_id, htlc.payment_hash, htlc.amount_msat, htlc.state);
4023
+
if htlc.state.preimage().is_some() {
4024
+
value_to_self_msat_offset -= htlc.amount_msat as i64;
4025
+
}
4032
4026
}
4033
4027
};
4034
4028
4035
-
// We MUST use saturating subs here, as the funder's balance is not guaranteed to be greater
4036
-
// than or equal to the sum of `total_fee_sat` and `total_anchors_sat`.
4029
+
// # Panics
4037
4030
//
4038
-
// This is because when the remote party sends an `update_fee` message, we build the new
4039
-
// commitment transaction *before* checking whether the remote party's balance is enough to
4040
-
// cover the total fee and the anchors.
4041
-
4042
-
let (value_to_self, value_to_remote) = if funding.is_outbound() {
0 commit comments