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