File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -431,8 +431,11 @@ impl PeerChannelEncryptor {
431
431
///
432
432
/// `msgbuf` must begin with 16 + 2 dummy/0 bytes, which will be filled with the encrypted
433
433
/// message length and its MAC. It should then be followed by the message bytes themselves
434
- /// (including the two byte message type), and have an extra 16 bytes of capacity remaining for
435
- /// the message MAC, which will be appended to the vec.
434
+ /// (including the two byte message type).
435
+ ///
436
+ /// For effeciency, the [`Vec::capacity`] should be at least 16 bytes larger than the
437
+ /// [`Vec::length`], to avoid reallocating for the message MAC, which will be appended to the
438
+ /// vec.
436
439
fn encrypt_message_with_header_0s ( & mut self , msgbuf : & mut Vec < u8 > ) {
437
440
let msg_len = msgbuf. len ( ) - 16 - 2 ;
438
441
if msg_len > LN_MAX_MSG_LEN {
You can’t perform that action at this time.
0 commit comments