1
0
Fork 0
mirror of https://github.com/ACINQ/eclair.git synced 2025-03-06 10:32:08 +01:00

Fix node announcement encoding (closes #124) (#136)

This commit is contained in:
Fabrice Drouin 2017-08-23 16:58:05 +02:00 committed by Pierre-Marie Padiou
parent 00aef5c438
commit 012d804474

View file

@ -40,7 +40,10 @@ object LightningMessageCodecs {
.typecase(2, ipv6address) ~ uint16) .typecase(2, ipv6address) ~ uint16)
.xmap(x => new InetSocketAddress(x._1, x._2), x => (x.getAddress, x.getPort)) .xmap(x => new InetSocketAddress(x._1, x._2), x => (x.getAddress, x.getPort))
def listofsocketaddresses: Codec[List[InetSocketAddress]] = listOfN(uint16, socketaddress) // this one is a bit different from most other codecs: the first 'len' element is * not * the number of items
// in the list but rather the number of bytes of the encoded list. The rationale is once we've read this
// number of bytes we can just skip to the next field
def listofsocketaddresses: Codec[List[InetSocketAddress]] = variableSizeBytes(uint16, list(socketaddress))
def signature: Codec[BinaryData] = Codec[BinaryData]( def signature: Codec[BinaryData] = Codec[BinaryData](
(der: BinaryData) => bytes(64).encode(ByteVector(der2wire(der).toArray)), (der: BinaryData) => bytes(64).encode(ByteVector(der2wire(der).toArray)),