Index unannounced channels on channelId instead of shortChannelId in the router#2269
Index unannounced channels on channelId instead of shortChannelId in the router#2269
channelId instead of shortChannelId in the router#2269Conversation
channelId instead of shortChannelId in RouterchannelId instead of shortChannelId in the router
b016368 to
1b431c3
Compare
1b431c3 to
e02752a
Compare
| resolveScid.get(scid).flatMap(privateChannels.get) match { | ||
| case Some(privateChannel) => Some(privateChannel) | ||
| case None => None | ||
| } |
There was a problem hiding this comment.
nit: you don't need the extra patter-matching:
resolveScid.get(scid).flatMap(privateChannels.get)But if you want to keep it for to make the code clearer, that works for me.
There was a problem hiding this comment.
It was for symmetry with the line above : Some(publicChannel)/Some(privateChannel). I'm not really happy with the resolve method.
| awaiting: Map[ChannelAnnouncement, Seq[GossipOrigin]], // note: this is a seq because we want to preserve order: first actor is the one who we need to send a tcp-ack when validation is done | ||
| privateChannels: Map[ShortChannelId, PrivateChannel], | ||
| privateChannels: Map[ByteVector32, PrivateChannel], // indexed by channel id | ||
| resolveScid: Map[ShortChannelId, ByteVector32], // scid to channel_id |
There was a problem hiding this comment.
Shouldn't we make it more explicit that this map is only used for private channels (currently) and unconfirmed channels (in the future)? There's no reason to store the mapping for public, announced channels, it's already in channels, right?
There was a problem hiding this comment.
Done with 1c0f453, also renamed the field. Added the comment, but it's weak, I wish we could enforce that somehow. Well we could by making fields private, but then updating the case class would be horrible. 🤷♂️
eclair-core/src/main/scala/fr/acinq/eclair/router/RouteCalculation.scala
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/router/Validation.scala
Outdated
Show resolved
Hide resolved
e02752a to
1c0f453
Compare
Builds on #2270.
This is the final preparatory step before we can introduce channel aliases, which are arbitrary values of type
ShortChannelId. We had to move to a stable identifier for private channels. Public channels can keep using theshortChannelId, it is stable because it is a "real scid" (and only used after 6 confs) and is useful as an index for channel queries.