@@ -235,10 +235,10 @@ func onionEncrypt(sharedSecret *Hash256, data []byte) []byte {
235235 return p
236236}
237237
238- // onionErrorLength is the expected length of the onion error message.
239- // Including padding, all messages on the wire should be 256 bytes. We then add
240- // the size of the sha256 HMAC as well.
241- const onionErrorLength = 2 + 2 + 256 + sha256 .Size
238+ // minOnionErrorLength is the minimally expected length of the onion error
239+ // message. Including padding, all messages on the wire should be at least 256
240+ // bytes. We then add the size of the sha256 HMAC as well.
241+ const minOnionErrorLength = 2 + 2 + 256 + sha256 .Size
242242
243243// DecryptError attempts to decrypt the passed encrypted error response. The
244244// onion failure is encrypted in backward manner, starting from the node where
@@ -250,9 +250,9 @@ func (o *OnionErrorDecrypter) DecryptError(encryptedData []byte) (
250250 * DecryptedError , error ) {
251251
252252 // Ensure the error message length is as expected.
253- if len (encryptedData ) != onionErrorLength {
253+ if len (encryptedData ) < minOnionErrorLength {
254254 return nil , fmt .Errorf ("invalid error length: " +
255- "expected %v got %v" , onionErrorLength ,
255+ "expected at least %v got %v" , minOnionErrorLength ,
256256 len (encryptedData ))
257257 }
258258
0 commit comments