@@ -4445,20 +4445,20 @@ where
4445
4445
4446
4446
fn htlc_failure_from_update_add_err(
4447
4447
&self, msg: &msgs::UpdateAddHTLC, counterparty_node_id: &PublicKey, err_msg: &'static str,
4448
- err_code : LocalHTLCFailureReason, is_intro_node_blinded_forward: bool,
4448
+ reason : LocalHTLCFailureReason, is_intro_node_blinded_forward: bool,
4449
4449
shared_secret: &[u8; 32]
4450
4450
) -> HTLCFailureMsg {
4451
4451
// at capacity, we write fields `htlc_msat` and `len`
4452
4452
let mut res = VecWriter(Vec::with_capacity(8 + 2));
4453
- if err_code .is_temporary() {
4454
- if err_code == LocalHTLCFailureReason::AmountBelowMinimum ||
4455
- err_code == LocalHTLCFailureReason::FeeInsufficient {
4453
+ if reason .is_temporary() {
4454
+ if reason == LocalHTLCFailureReason::AmountBelowMinimum ||
4455
+ reason == LocalHTLCFailureReason::FeeInsufficient {
4456
4456
msg.amount_msat.write(&mut res).expect("Writes cannot fail");
4457
4457
}
4458
- else if err_code == LocalHTLCFailureReason::IncorrectCLTVExpiry {
4458
+ else if reason == LocalHTLCFailureReason::IncorrectCLTVExpiry {
4459
4459
msg.cltv_expiry.write(&mut res).expect("Writes cannot fail");
4460
4460
}
4461
- else if err_code == LocalHTLCFailureReason::ChannelDisabled {
4461
+ else if reason == LocalHTLCFailureReason::ChannelDisabled {
4462
4462
// TODO: underspecified, follow https://github.com/lightning/bolts/issues/791
4463
4463
0u16.write(&mut res).expect("Writes cannot fail");
4464
4464
}
@@ -4483,7 +4483,7 @@ where
4483
4483
let (reason, err_data) = if is_intro_node_blinded_forward {
4484
4484
(LocalHTLCFailureReason::InvalidOnionBlinding, &[0; 32][..])
4485
4485
} else {
4486
- (err_code , &res.0[..])
4486
+ (reason , &res.0[..])
4487
4487
};
4488
4488
let failure = HTLCFailReason::reason(reason, err_data.to_vec())
4489
4489
.get_encrypted_failure_packet(shared_secret, &None);
@@ -5820,9 +5820,9 @@ where
5820
5820
)
5821
5821
}) {
5822
5822
Some(Ok(_)) => {},
5823
- Some(Err((err, code ))) => {
5823
+ Some(Err((err, reason ))) => {
5824
5824
let htlc_fail = self.htlc_failure_from_update_add_err(
5825
- &update_add_htlc, &incoming_counterparty_node_id, err, code ,
5825
+ &update_add_htlc, &incoming_counterparty_node_id, err, reason ,
5826
5826
is_intro_node_blinded_forward, &shared_secret,
5827
5827
);
5828
5828
let htlc_destination = get_failed_htlc_destination(outgoing_scid_opt, update_add_htlc.payment_hash);
@@ -5835,11 +5835,11 @@ where
5835
5835
5836
5836
// Now process the HTLC on the outgoing channel if it's a forward.
5837
5837
if let Some(next_packet_details) = next_packet_details_opt.as_ref() {
5838
- if let Err((err, code )) = self.can_forward_htlc(
5838
+ if let Err((err, reason )) = self.can_forward_htlc(
5839
5839
&update_add_htlc, next_packet_details
5840
5840
) {
5841
5841
let htlc_fail = self.htlc_failure_from_update_add_err(
5842
- &update_add_htlc, &incoming_counterparty_node_id, err, code ,
5842
+ &update_add_htlc, &incoming_counterparty_node_id, err, reason ,
5843
5843
is_intro_node_blinded_forward, &shared_secret,
5844
5844
);
5845
5845
let htlc_destination = get_failed_htlc_destination(outgoing_scid_opt, update_add_htlc.payment_hash);
0 commit comments