-
Notifications
You must be signed in to change notification settings - Fork 267
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
Improve Origin
and Upstream
#2872
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
352b2f9
to
b36dc39
Compare
replyTo
Origin
and Upstream
b36dc39
to
b6707a1
Compare
b6707a1
to
e62511b
Compare
We move the `Upstream` trait closer to the `Origin`, and make it more obvious than a hot `Origin` is: - an `Upstream` referencing the upstream HTLCs - an actor requesting the outgoing payment We also improve the cold trampoline relay class to record the incoming HTLC amount, which we previously didn't bother encoding but is useful to compute the fees collected during relay. To ensure backwards-compat, it is set to `0 msat` for pending HTLCs. It will only affect HTLCs that were pending during the upgrade, which is acceptable.
e62511b
to
cef3ec5
Compare
We actually don't need to pattern match on local/channel/trampoline for a `Hot` origin, because we instead just send back a result to the `replyTo` actor. It's only when the origin is `Cold` that we're interested in pattern matching on the type of payment (exclusively done in the `PostRestartHtlcCleaner`). The only exception is to skip local origins, but it happens in only two places so it's probably ok to have a slightly more complex pattern matching in that case.
And move the channel/trampoline cases to `Upstream.Cold`.
pm47
previously approved these changes
Jun 27, 2024
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.
I redid the codecs from scratch and compared with yours: they match, so we should be safe.
eclair-core/src/main/scala/fr/acinq/eclair/wire/internal/channel/version4/ChannelCodecs4.scala
Outdated
Show resolved
Hide resolved
pm47
approved these changes
Jun 27, 2024
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.
🎉
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We move the
Upstream
trait closer to theOrigin
, and make it more obvious than a hotOrigin
is:Upstream
referencing the upstream HTLCsWe also improve the cold trampoline relay class to record the incoming HTLC amount, which we previously didn't bother encoding but is useful to compute the fees collected during relay. To ensure backwards-compat, it is set to
0 msat
for pending HTLCs. It will only affect HTLCs that were pending during the upgrade, which is acceptable.This is useful for cases where we relay after a delay (e.g. after waiting for on-chain funding), where we will store
Upstream
instances while we wait for the relay condition to be met, and then transform them intoOrigin.Hot
when we create an actor to relay the payment.