]> git.bitcoin.ninja Git - rust-lightning/commit
Avoid unnecessarily alloc'ing a new buffer when decrypting messages
authorMatt Corallo <git@bluematt.me>
Mon, 6 Nov 2023 16:57:13 +0000 (16:57 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 7 Nov 2023 18:13:23 +0000 (18:13 +0000)
commit48edd01d02a68258c046bff0e2bd05d25efd28ce
treedb256c4f27eaf9f94c3cf4b38eefe2c2cf51f41f
parent5e34bc4404e111d94db0ab68b9996246f5d105f9
Avoid unnecessarily alloc'ing a new buffer when decrypting messages

When decrypting P2P messages, we already have a read buffer that we
read the message into. There's no reason to allocate a new `Vec` to
store the decrypted message when we can just overwrite the read
buffer and call it a day.
fuzz/src/peer_crypt.rs
lightning/src/ln/peer_channel_encryptor.rs
lightning/src/ln/peer_handler.rs