Skip to content

Commit 3b2d661

Browse files
committed
ln: add length assertion for invalid onion failure code
Although the specification allows an all-zero sha256_of_onion for invalid_onion_blinding errors, it still requires that the value is set.
1 parent 3188095 commit 3b2d661

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

lightning/src/ln/onion_utils.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1458,6 +1458,7 @@ impl HTLCFailReason {
14581458
else if failure_code == 21 { debug_assert!(data.is_empty()) }
14591459
else if failure_code == 22 | PERM { debug_assert!(data.len() <= 11) }
14601460
else if failure_code == 23 { debug_assert!(data.is_empty()) }
1461+
else if failure_code == INVALID_ONION_BLINDING { debug_assert_eq!(data.len(), 32) }
14611462
else if failure_code & BADONION != 0 {
14621463
// We set some bogus BADONION failure codes in test, so ignore unknown ones.
14631464
}

0 commit comments

Comments
 (0)