Skip to content

Commit 6e7a575

Browse files
committed
ln/refactor: rename misc error_code related vars in channelmanager
Now that we're not passing around error codes, update variable names accordingly.
1 parent d063122 commit 6e7a575

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4446,20 +4446,20 @@ where
44464446

44474447
fn htlc_failure_from_update_add_err(
44484448
&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,
44504450
shared_secret: &[u8; 32]
44514451
) -> HTLCFailureMsg {
44524452
// at capacity, we write fields `htlc_msat` and `len`
44534453
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 {
44574457
msg.amount_msat.write(&mut res).expect("Writes cannot fail");
44584458
}
4459-
else if err_code == LocalHTLCFailureReason::IncorrectCLTVExpiry {
4459+
else if reason == LocalHTLCFailureReason::IncorrectCLTVExpiry {
44604460
msg.cltv_expiry.write(&mut res).expect("Writes cannot fail");
44614461
}
4462-
else if err_code == LocalHTLCFailureReason::ChannelDisabled {
4462+
else if reason == LocalHTLCFailureReason::ChannelDisabled {
44634463
// TODO: underspecified, follow https://github.com/lightning/bolts/issues/791
44644464
0u16.write(&mut res).expect("Writes cannot fail");
44654465
}
@@ -4484,7 +4484,7 @@ where
44844484
let (reason, err_data) = if is_intro_node_blinded_forward {
44854485
(LocalHTLCFailureReason::InvalidOnionBlinding, &[0; 32][..])
44864486
} else {
4487-
(err_code, &res.0[..])
4487+
(reason, &res.0[..])
44884488
};
44894489
let failure = HTLCFailReason::reason(reason, err_data.to_vec())
44904490
.get_encrypted_failure_packet(shared_secret, &None);
@@ -5821,9 +5821,9 @@ where
58215821
)
58225822
}) {
58235823
Some(Ok(_)) => {},
5824-
Some(Err((err, code))) => {
5824+
Some(Err((err, reason))) => {
58255825
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,
58275827
is_intro_node_blinded_forward, &shared_secret,
58285828
);
58295829
let htlc_destination = get_failed_htlc_destination(outgoing_scid_opt, update_add_htlc.payment_hash);
@@ -5836,11 +5836,11 @@ where
58365836

58375837
// Now process the HTLC on the outgoing channel if it's a forward.
58385838
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(
58405840
&update_add_htlc, next_packet_details
58415841
) {
58425842
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,
58445844
is_intro_node_blinded_forward, &shared_secret,
58455845
);
58465846
let htlc_destination = get_failed_htlc_destination(outgoing_scid_opt, update_add_htlc.payment_hash);

0 commit comments

Comments
 (0)