Skip to content

Commit 8ee85bf

Browse files
authored
Merge pull request #3699 from carlaKC/3541-prefactor
(1/3) Minor error code fixes
2 parents e56c14f + 3b2d661 commit 8ee85bf

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Diff for: lightning/src/ln/blinded_payment_tests.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2160,7 +2160,7 @@ fn do_test_trampoline_single_hop_receive(success: bool) {
21602160
}
21612161
{
21622162
let payment_failed_conditions = PaymentFailedConditions::new()
2163-
.expected_htlc_error_data(INVALID_ONION_BLINDING, &[0; 0]);
2163+
.expected_htlc_error_data(0x4000 | 22, &[0; 0]);
21642164
expect_payment_failed_conditions(&nodes[0], payment_hash, true, payment_failed_conditions);
21652165
}
21662166
}

Diff for: lightning/src/ln/onion_utils.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1547,8 +1547,7 @@ impl HTLCFailReason {
15471547
const NODE: u16 = 0x2000;
15481548
const UPDATE: u16 = 0x1000;
15491549

1550-
if failure_code == 1 | PERM { debug_assert!(data.is_empty()) }
1551-
else if failure_code == 2 | NODE { debug_assert!(data.is_empty()) }
1550+
if failure_code == 2 | NODE { debug_assert!(data.is_empty()) }
15521551
else if failure_code == 2 | PERM | NODE { debug_assert!(data.is_empty()) }
15531552
else if failure_code == 3 | PERM | NODE { debug_assert!(data.is_empty()) }
15541553
else if failure_code == 4 | BADONION | PERM { debug_assert_eq!(data.len(), 32) }
@@ -1575,6 +1574,7 @@ impl HTLCFailReason {
15751574
else if failure_code == 21 { debug_assert!(data.is_empty()) }
15761575
else if failure_code == 22 | PERM { debug_assert!(data.len() <= 11) }
15771576
else if failure_code == 23 { debug_assert!(data.is_empty()) }
1577+
else if failure_code == INVALID_ONION_BLINDING { debug_assert_eq!(data.len(), 32) }
15781578
else if failure_code & BADONION != 0 {
15791579
// We set some bogus BADONION failure codes in test, so ignore unknown ones.
15801580
}
@@ -1975,7 +1975,7 @@ where
19751975
if hop_data.intro_node_blinding_point.is_some() {
19761976
return Err(OnionDecodeErr::Relay {
19771977
err_msg: "Non-final intro node Trampoline onion data provided to us as last hop",
1978-
err_code: INVALID_ONION_BLINDING,
1978+
err_code: 0x4000 | 22,
19791979
shared_secret,
19801980
trampoline_shared_secret: Some(SharedSecret::from_bytes(
19811981
trampoline_shared_secret,
@@ -2175,8 +2175,8 @@ fn decode_next_hop<T, R: ReadableArgs<T>, N: NextPacketBytes>(
21752175
match R::read(&mut chacha_stream, read_args) {
21762176
Err(err) => {
21772177
let error_code = match err {
2178-
// Unknown realm byte
2179-
msgs::DecodeError::UnknownVersion => 0x4000 | 1,
2178+
// Unknown version
2179+
msgs::DecodeError::UnknownVersion => 0x8000 | 0x4000 | 4,
21802180
// invalid_onion_payload
21812181
msgs::DecodeError::UnknownRequiredFeature
21822182
| msgs::DecodeError::InvalidValue

0 commit comments

Comments
 (0)