Skip to content

Commit 6f442d9

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 daae398 commit 6f442d9

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
@@ -4445,20 +4445,20 @@ where
44454445

44464446
fn htlc_failure_from_update_add_err(
44474447
&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,
44494449
shared_secret: &[u8; 32]
44504450
) -> HTLCFailureMsg {
44514451
// at capacity, we write fields `htlc_msat` and `len`
44524452
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 {
44564456
msg.amount_msat.write(&mut res).expect("Writes cannot fail");
44574457
}
4458-
else if err_code == LocalHTLCFailureReason::IncorrectCLTVExpiry {
4458+
else if reason == LocalHTLCFailureReason::IncorrectCLTVExpiry {
44594459
msg.cltv_expiry.write(&mut res).expect("Writes cannot fail");
44604460
}
4461-
else if err_code == LocalHTLCFailureReason::ChannelDisabled {
4461+
else if reason == LocalHTLCFailureReason::ChannelDisabled {
44624462
// TODO: underspecified, follow https://github.com/lightning/bolts/issues/791
44634463
0u16.write(&mut res).expect("Writes cannot fail");
44644464
}
@@ -4483,7 +4483,7 @@ where
44834483
let (reason, err_data) = if is_intro_node_blinded_forward {
44844484
(LocalHTLCFailureReason::InvalidOnionBlinding, &[0; 32][..])
44854485
} else {
4486-
(err_code, &res.0[..])
4486+
(reason, &res.0[..])
44874487
};
44884488
let failure = HTLCFailReason::reason(reason, err_data.to_vec())
44894489
.get_encrypted_failure_packet(shared_secret, &None);
@@ -5820,9 +5820,9 @@ where
58205820
)
58215821
}) {
58225822
Some(Ok(_)) => {},
5823-
Some(Err((err, code))) => {
5823+
Some(Err((err, reason))) => {
58245824
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,
58265826
is_intro_node_blinded_forward, &shared_secret,
58275827
);
58285828
let htlc_destination = get_failed_htlc_destination(outgoing_scid_opt, update_add_htlc.payment_hash);
@@ -5835,11 +5835,11 @@ where
58355835

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

0 commit comments

Comments
 (0)