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:
parent
5d662fc3d7
commit
8065d0bb80
2 changed files with 4 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue