Add `FailureCode::InvalidOnionPayload` variant
authorAlec Chen <alecchendev@gmail.com>
Thu, 8 Jun 2023 04:17:09 +0000 (23:17 -0500)
committerAlec Chen <alecchendev@gmail.com>
Tue, 8 Aug 2023 21:16:44 +0000 (16:16 -0500)
commit8ff16046475b39c280b85dede5f0912269aed28c
treed5e8122ce3376073e1d74acad984dc9d06535f53
parente84fb067aa0e48f5851cb491354cdcdc94d063c7
Add `FailureCode::InvalidOnionPayload` variant

When a user decodes custom TLVs, if they fail to recognize even type
numbers they should fail back with the correct failure code and fail
data. This new variant adds the proper failure variant for the user to
pass into `ChannelManager::fail_htlc_backwards_with_reason`.

Note that the enum discriminants were removed because when adding a
struct variant we can no longer make use of the discriminant through
casting like we previously did, and instead have to manually define the
associated failure code anyway.
lightning/src/ln/channelmanager.rs
lightning/src/ln/onion_route_tests.rs