X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fln%2Fwire.rs;h=86d8bfdd494e5ffad0bd7a67ff361009f4aa5bb5;hb=4e82003261e11ece5d5fb3b13f686c9f7a0d2aaf;hp=dc09bbe237384da2523bd91705774648796983e7;hpb=caed31a1e65d1c605dc8beecb8ffa90f05b492db;p=rust-lightning diff --git a/lightning/src/ln/wire.rs b/lightning/src/ln/wire.rs index dc09bbe2..86d8bfdd 100644 --- a/lightning/src/ln/wire.rs +++ b/lightning/src/ln/wire.rs @@ -1,3 +1,12 @@ +// This file is Copyright its original authors, visible in version control +// history. +// +// This file is licensed under the Apache License, Version 2.0 or the MIT license +// , at your option. +// You may not use this file except in accordance with one or both of these +// licenses. + //! Wire encoding/decoding for Lightning messages according to [BOLT #1]. //! //! Messages known by this module can be read from the wire using [`read`]. @@ -16,13 +25,6 @@ use ln::msgs; use util::ser::{Readable, Writeable, Writer}; -/// Maximum Lightning message data length according to -/// [BOLT-8](https://github.com/lightningnetwork/lightning-rfc/blob/v1.0/08-transport.md#lightning-message-specification): -/// "The maximum size of any Lightning message MUST NOT exceed 65535 bytes. -/// A maximum size of 65535 simplifies testing, makes memory management easier, -/// and helps mitigate memory-exhaustion attacks." -pub const LN_MAX_MSG_LEN: usize = std::u16::MAX as usize; // Must be equal to 65535 - /// A Lightning message returned by [`read`] when decoding bytes received over the wire. Each /// variant contains a message from [`ln::msgs`] or otherwise the message type if unknown. /// @@ -318,12 +320,6 @@ mod tests { // Big-endian wire encoding of Pong message (type = 19, byteslen = 2). const ENCODED_PONG: [u8; 6] = [0u8, 19u8, 0u8, 2u8, 0u8, 0u8]; - #[test] - fn max_msg_len() { - assert_eq!(LN_MAX_MSG_LEN, 65535); - assert_eq!(LN_MAX_MSG_LEN, std::u16::MAX as usize); - } - #[test] fn read_empty_buffer() { let buffer = [];