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:
parent
fa2cc57ca6
commit
07ac278771
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user