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