From 7a65be7f14f82dd8dfc3b4615c6eb44a92f6ff51 Mon Sep 17 00:00:00 2001 From: nsa Date: Wed, 6 Feb 2019 07:02:10 -0500 Subject: [PATCH] lnwire: features "maxAllowedSize" fix --- lnwire/features.go | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/lnwire/features.go b/lnwire/features.go index e4cbe5de..1dd536ba 100644 --- a/lnwire/features.go +++ b/lnwire/features.go @@ -49,16 +49,14 @@ const ( // maxAllowedSize is a maximum allowed size of feature vector. // // NOTE: Within the protocol, the maximum allowed message size is 65535 - // bytes. Adding the overhead from the crypto protocol (the 2-byte - // packet length and 16-byte MAC), we arrive at 65569 bytes. Accounting - // for the overhead within the feature message to signal the type of - // the message, that leaves 65567 bytes for the init message itself. - // Next, we reserve 4-bytes to encode the lengths of both the local and - // global feature vectors, so 65563 for the global and local features. - // Knocking off one byte for the sake of the calculation, that leads to - // a max allowed size of 32781 bytes for each feature vector, or 131124 - // different features. - maxAllowedSize = 32781 + // bytes for all messages. Accounting for the overhead within the feature + // message to signal the type of message, that leaves us with 65533 bytes + // for the init message itself. Next, we reserve 4 bytes to encode the + // lengths of both the local and global feature vectors, so 65529 bytes + // for the local and global features. Knocking off one byte for the sake + // of the calculation, that leads us to 32764 bytes for each feature + // vector, or 131056 different features. + maxAllowedSize = 32764 ) // LocalFeatures is a mapping of known connection-local feature bits to a