Correctly wrap phantom onion errors
authorValentine Wallace <vwallace@protonmail.com>
Fri, 25 Feb 2022 03:28:58 +0000 (22:28 -0500)
committerValentine Wallace <vwallace@protonmail.com>
Fri, 25 Feb 2022 03:33:02 +0000 (22:33 -0500)
commit26fe87989607ff459b7f30cd676a6a2b9f8cf1b0
treef083471a9f69089f7e2014da38c48c5daaf97610
parent3faea334389a2cf92b2122a8aa464d63de21ca70
Correctly wrap phantom onion errors

In any place where fail_htlc_backwards_internal was called for a phantom payment
failure, we weren't encoding the onion failure as if the phantom were the one
failing. Instead, we were encoding the failure as if it were coming from the
second-to-last hop. This caused our failures to not be parsed properly on the
payer's side.

Places we were encoding failures incorrectly include:
* on failure of a call to inbound_payment::verify
* on a user call to fail_htlc_backwards

Also drop some unnecessary panics when reading OnionHopData objects. This also
enables one of the phantom failure tests because we can construct OnionHopDatas
with invalid amounts.

Lastly, remove a bogus comment
lightning/src/ln/channelmanager.rs
lightning/src/ln/msgs.rs
lightning/src/ln/onion_route_tests.rs