-
Notifications
You must be signed in to change notification settings - Fork 130
PaymentBandwidth
uses HtlcView
#1462
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
base: main
Are you sure you want to change the base?
Conversation
Pull Request Test Coverage Report for Build 14516181401Details
💛 - Coveralls |
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.
Code wise this looks good to me. But IMO we'd want a bit more certainty around whether this really works in all cases.
b3e79c5
to
1f94c7a
Compare
1f94c7a
to
9bd9d79
Compare
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.
Nice, I think the code is correct now for our use case.
Now it's just code style and reviewer friendliness that can be improved somewhat.
98260c9
to
8e9b450
Compare
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, thanks!
To make `PaymentBandwidth` more readable, we separate the main codepaths into helper functions. One is used when we're directly comparing asset units to each other, and the other one is the path that calculates an msat amount based on an RFQ quote.
We now make use of the AuxHtlcView to calculate a more precise value of our local balance. This is using the ComputeView helper in order to manually process HTLC adds from our side, providing us with the correct value of local balance. We also add the DecodedView as a return value of the helper function, but this will only be used in the next commit for verbose logging.
We add a trace log which includes a pretty print of the HTLCs that are part of our local update log.
8e9b450
to
3182e35
Compare
Description
When
AuxTrafficShaper.PaymentBandwidth
is called asynchonously we could previously report the same bandwidth for 2 different HTLCs that are validating whether they can be added to the channel. This could lead to false-positives and payment failures as the latter HTLC should be checked against the correct bandwidth.Instead of always consulting the commitment blob on what the current asset balance is, we now use the existing helper
ComputeView
to get a more precise representation of the asset balance, which is enabled by the new argumentlnwallet.HtlcView
.