From 4b12f40a48e580f3b34b7f43eb600b3aaed787b2 Mon Sep 17 00:00:00 2001 From: yyforyongyu Date: Thu, 17 Jun 2021 10:49:33 +0800 Subject: [PATCH] lnwire: remove unused MaxMessagePayload const MaxMessagePayload and MaxSliceLength are duplicate variables. This commit deletes MaxMessagePayload and keeps MaxSliceLength. --- buffer/read.go | 2 +- buffer/write.go | 2 +- lnwire/message.go | 4 ---- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/buffer/read.go b/buffer/read.go index 57050d58f..f38ab971e 100644 --- a/buffer/read.go +++ b/buffer/read.go @@ -7,7 +7,7 @@ import ( // ReadSize represents the size of the maximum message that can be read off the // wire by brontide. The buffer is used to hold the ciphertext while the // brontide state machine decrypts the message. -const ReadSize = lnwire.MaxMessagePayload + 16 +const ReadSize = lnwire.MaxSliceLength + 16 // Read is a static byte array sized to the maximum-allowed Lightning message // size, plus 16 bytes for the MAC. diff --git a/buffer/write.go b/buffer/write.go index 47010c29b..712571b97 100644 --- a/buffer/write.go +++ b/buffer/write.go @@ -7,7 +7,7 @@ import ( // WriteSize represents the size of the maximum plaintext message than can be // sent using brontide. The buffer does not include extra space for the MAC, as // that is applied by the Noise protocol after encrypting the plaintext. -const WriteSize = lnwire.MaxMessagePayload +const WriteSize = lnwire.MaxSliceLength // Write is static byte array occupying to maximum-allowed plaintext-message // size. diff --git a/lnwire/message.go b/lnwire/message.go index 048122887..c4f2fd36a 100644 --- a/lnwire/message.go +++ b/lnwire/message.go @@ -12,10 +12,6 @@ import ( "io" ) -// MaxMessagePayload is the maximum bytes a message can be regardless of other -// individual limits imposed by messages themselves. -const MaxMessagePayload = 65535 // 65KB - // MessageType is the unique 2 byte big-endian integer that indicates the type // of message on the wire. All messages have a very simple header which // consists simply of 2-byte message type. We omit a length field, and checksum