Merge pull request #1068 from TheBlueMatt/2021-09-ser-cleanup
[rust-lightning] / lightning / src / ln / peer_handler.rs
index 2470058f58960378f199a3e02e5703d22feb92e2..c9bc40c945aa5df7263aec01667a55d17eddad0d 100644 (file)
@@ -720,7 +720,7 @@ impl<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, L: Deref, CMH: Deref> P
 
        /// Append a message to a peer's pending outbound/write buffer, and update the map of peers needing sends accordingly.
        fn enqueue_message<M: wire::Type + Writeable + Debug>(&self, peer: &mut Peer, message: &M) {
-               let mut buffer = VecWriter(Vec::new());
+               let mut buffer = VecWriter(Vec::with_capacity(2048));
                wire::write(message, &mut buffer).unwrap(); // crash if the write failed
                let encoded_message = buffer.0;