Fix encryption of broadcasted gossip messages
authorMatt Corallo <git@bluematt.me>
Mon, 12 Sep 2022 15:16:41 +0000 (15:16 +0000)
committerMatt Corallo <git@bluematt.me>
Mon, 12 Sep 2022 18:06:52 +0000 (18:06 +0000)
commit8ec92f5b6bb2b204708252427b1fd6835f358c58
tree408d77d14d05aa1f496d4c024f444d0bffcff5b0
parent15a5966fa24286ca805aea3a97e606b10c71543d
Fix encryption of broadcasted gossip messages

In 47e818f198abafba01b9ad278582886f9007dac2, forwarding broadcasted
gossip messages was split into a separate per-peer message buffer.
However, both it and the original regular-message queue are
encrypted immediately when the messages are enqueued. Because the
lightning P2P encryption algorithm is order-dependent, this causes
messages to fail their MAC checks as the messages from the two
queues may not be sent to peers in the order in which they were
encrypted.

The fix is to simply queue broadcast gossip messages unencrypted,
encrypting them when we add them to the regular outbound buffer.
lightning/src/ln/peer_handler.rs