]> git.bitcoin.ninja Git - rust-lightning/commit
Avoid re-allocating to encrypt gossip messages when forwarding
authorMatt Corallo <git@bluematt.me>
Sat, 4 Nov 2023 20:37:21 +0000 (20:37 +0000)
committerMatt Corallo <git@bluematt.me>
Thu, 9 Nov 2023 22:28:08 +0000 (22:28 +0000)
commit969085bf1e77ebe5b4e7cb0523311e9905fa20f3
tree30630095a5ffad29de5c8de7aed3843765e0c959
parent0503df88c75936f7e64a8aafbf80e28389e7dcde
Avoid re-allocating to encrypt gossip messages when forwarding

When we forward gossip messages, we store them in a separate buffer
before we encrypt them (and commit to the order in which they'll
appear on the wire). Rather than storing that buffer encoded with
no headroom, requiring re-allocating to add the message length and
two MAC blocks, we here add the headroom prior to pushing it into
the gossip buffer, avoiding an allocation.
fuzz/src/peer_crypt.rs
lightning/src/ln/peer_channel_encryptor.rs
lightning/src/ln/peer_handler.rs