1
0
Fork 0
mirror of https://github.com/ACINQ/eclair.git synced 2025-02-23 06:35:11 +01:00

Add a serializer for DoSync (#1708)

This command is sent by the `Peer` to its `PeerConnection`, therefore it
needs to be a `RemoteType` and have its own codec.
This commit is contained in:
Pierre-Marie Padiou 2021-02-26 12:09:21 +01:00 committed by GitHub
parent 5d662fc3d7
commit 8065d0bb80
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View file

@ -464,7 +464,7 @@ object PeerConnection {
case object InitTimeout
case object SendPing
case object ResumeAnnouncements
case class DoSync(replacePrevious: Boolean)
case class DoSync(replacePrevious: Boolean) extends RemoteTypes
// @formatter:on
val IGNORE_NETWORK_ANNOUNCEMENTS_PERIOD: FiniteDuration = 5 minutes

View file

@ -78,6 +78,8 @@ object EclairInternalsSerializer {
("pingDisconnect" | bool(8)) ::
("maxRebroadcastDelay" | finiteDurationCodec)).as[PeerConnection.Conf]
val peerConnectionDoSyncCodec: Codec[PeerConnection.DoSync] = bool(8).as[PeerConnection.DoSync]
val peerConnectionKillReasonCodec: Codec[PeerConnection.KillReason] = discriminated[PeerConnection.KillReason].by(uint16)
.typecase(0, provide(PeerConnection.KillReason.UserRequest))
.typecase(1, provide(PeerConnection.KillReason.NoRemainingChannel))
@ -179,5 +181,6 @@ object EclairInternalsSerializer {
.typecase(50, lengthPrefixedChannelUpdateCodec.as[GossipDecision.RelatedChannelPruned])
.typecase(51, lengthPrefixedChannelAnnouncementCodec.as[GossipDecision.ChannelClosed])
.typecase(52, peerConnectionKillCodec)
.typecase(53, peerConnectionDoSyncCodec)
}