Support reading `channel_update`s in onions with message type bytes 2022-04-update-type-bytes
authorMatt Corallo <git@bluematt.me>
Sun, 3 Apr 2022 17:06:44 +0000 (17:06 +0000)
committerMatt Corallo <git@bluematt.me>
Wed, 27 Apr 2022 01:34:13 +0000 (01:34 +0000)
commitce07ed546f1b0717f1fcc679131bd373aa0018ce
tree5f1f8b7cf22bd5379935f355de78562d497294c7
parent72069bfc9d082d3d142cfa09dca2bf6e1f085710
Support reading `channel_update`s in onions with message type bytes

Historically c-lightning and eclair have always sent
`channel_update` messages inside the onion error packets with the
two message type bytes (`0x0102` for `channel_update` messages) but
lnd and us skipped those bytes. We only supported decoding messages
matching our own encoding - decoding a bogus `channel_update` if
the extra bytes were included.

Here we detect the type bytes and, if they're present, start
reading at offset 2.

We also take this opportunity to improve loging and make the
severity more accurate for the previous error.

Fixes #1450.
lightning/src/ln/onion_utils.rs