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 committed 2018-01-19 10:52:24 -05:00
1 parent fa2cc57ca6
commit 07ac278771
1 file changed
+1 -1
+1 -1
View File
@@ -700,7 +700,7 @@ func parseFieldDataLength(data []byte) (uint16, error) {
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)