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