-
Notifications
You must be signed in to change notification settings - Fork 276
Index unannounced channels on channelId instead of shortChannelId in the router
#2269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
t-bast
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
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.