invoice: properly parse the field data length

When accessing a value from a byte slice, the value is returned as a
byte, which is just a uint8. When the first byte takes more than 3 bits
of space, shifting 5 bits left results in data loss.
This commit is contained in:
Wilmer Paulino 2018-01-09 07:08:21 -05:00
parent fa2cc57ca6
commit 07ac278771
No known key found for this signature in database
GPG Key ID: 6DF57B9F9514972F

@ -700,7 +700,7 @@ func parseFieldDataLength(data []byte) (uint16, error) {
len(data)) len(data))
} }
return uint16(data[0]<<5) | uint16(data[1]), nil return uint16(data[0])<<5 | uint16(data[1]), nil
} }
// parsePaymentHash converts a 256-bit payment hash (encoded in base32) // parsePaymentHash converts a 256-bit payment hash (encoded in base32)