diff --git a/eclair-core/src/main/scala/fr/acinq/eclair/wire/internal/channel/version0/ChannelCodecs0.scala b/eclair-core/src/main/scala/fr/acinq/eclair/wire/internal/channel/version0/ChannelCodecs0.scala index ee03273f51..3dce2bf7ba 100644 --- a/eclair-core/src/main/scala/fr/acinq/eclair/wire/internal/channel/version0/ChannelCodecs0.scala +++ b/eclair-core/src/main/scala/fr/acinq/eclair/wire/internal/channel/version0/ChannelCodecs0.scala @@ -51,10 +51,9 @@ private[channel] object ChannelCodecs0 { ("chaincode" | bytes32) :: ("depth" | uint16) :: ("path" | keyPathCodec) :: - ("parent" | int64)).xmap( - { case a :: b :: c :: d :: e :: HNil => ExtendedPrivateKey(a, b, c, d, e) }, - { exp: ExtendedPrivateKey => exp.secretkeybytes :: exp.chaincode :: exp.depth :: exp.path :: exp.parent :: HNil } - ).decodeOnly + ("parent" | int64)) + .map { case a :: b :: c :: d :: e :: HNil => ExtendedPrivateKey(a, b, c, d, e) } + .decodeOnly val channelVersionCodec: Codec[ChannelTypes0.ChannelVersion] = discriminatorWithDefault[ChannelTypes0.ChannelVersion]( discriminator = discriminated[ChannelTypes0.ChannelVersion].by(byte) diff --git a/eclair-core/src/main/scala/fr/acinq/eclair/wire/internal/channel/version1/ChannelCodecs1.scala b/eclair-core/src/main/scala/fr/acinq/eclair/wire/internal/channel/version1/ChannelCodecs1.scala index e1fc5e2518..4337f43b40 100644 --- a/eclair-core/src/main/scala/fr/acinq/eclair/wire/internal/channel/version1/ChannelCodecs1.scala +++ b/eclair-core/src/main/scala/fr/acinq/eclair/wire/internal/channel/version1/ChannelCodecs1.scala @@ -44,10 +44,9 @@ private[channel] object ChannelCodecs1 { ("chaincode" | bytes32) :: ("depth" | uint16) :: ("path" | keyPathCodec) :: - ("parent" | int64)).xmap( - { case a :: b :: c :: d :: e :: HNil => ExtendedPrivateKey(a, b, c, d, e) }, - { exp: ExtendedPrivateKey => exp.secretkeybytes :: exp.chaincode :: exp.depth :: exp.path :: exp.parent :: HNil } - ) + ("parent" | int64)) + .map { case a :: b :: c :: d :: e :: HNil => ExtendedPrivateKey(a, b, c, d, e) } + .decodeOnly val channelVersionCodec: Codec[ChannelTypes0.ChannelVersion] = bits(ChannelTypes0.ChannelVersion.LENGTH_BITS).as[ChannelTypes0.ChannelVersion] diff --git a/eclair-core/src/main/scala/fr/acinq/eclair/wire/internal/channel/version2/ChannelCodecs2.scala b/eclair-core/src/main/scala/fr/acinq/eclair/wire/internal/channel/version2/ChannelCodecs2.scala index 155c648267..0dab10a8fc 100644 --- a/eclair-core/src/main/scala/fr/acinq/eclair/wire/internal/channel/version2/ChannelCodecs2.scala +++ b/eclair-core/src/main/scala/fr/acinq/eclair/wire/internal/channel/version2/ChannelCodecs2.scala @@ -44,10 +44,9 @@ private[channel] object ChannelCodecs2 { ("chaincode" | bytes32) :: ("depth" | uint16) :: ("path" | keyPathCodec) :: - ("parent" | int64)).xmap( - { case a :: b :: c :: d :: e :: HNil => ExtendedPrivateKey(a, b, c, d, e) }, - { exp: ExtendedPrivateKey => exp.secretkeybytes :: exp.chaincode :: exp.depth :: exp.path :: exp.parent :: HNil } - ) + ("parent" | int64)) + .map { case a :: b :: c :: d :: e :: HNil => ExtendedPrivateKey(a, b, c, d, e) } + .decodeOnly val channelVersionCodec: Codec[ChannelTypes0.ChannelVersion] = bits(ChannelTypes0.ChannelVersion.LENGTH_BITS).as[ChannelTypes0.ChannelVersion]