-
Notifications
You must be signed in to change notification settings - Fork 2.2k
AuxTrafficShaper.PaymentBandwidth uses HTLC view
#9687
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
Changes from all commits
b96d57e
a279058
53254c7
d0ef248
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2704,6 +2704,20 @@ func (v *HtlcView) AuxTheirUpdates() []AuxHtlcDescriptor { | |
| return fn.Map(v.Updates.Remote, newAuxHtlcDescriptor) | ||
| } | ||
|
|
||
| // FetchLatestAuxHTLCView returns the latest HTLC view of the lightning channel | ||
| // as a safe copy that can be used outside the wallet code in concurrent access. | ||
| func (lc *LightningChannel) FetchLatestAuxHTLCView() AuxHtlcView { | ||
| // This read lock is important, because we access both the local and | ||
| // remote log indexes as well as the underlying payment descriptors of | ||
| // the HTLCs when creating the view. | ||
| lc.RLock() | ||
| defer lc.RUnlock() | ||
|
|
||
| return newAuxHtlcView(lc.fetchHTLCView( | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure how For instance, in
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The reason I picked these values is because I want the greatest value at the time of calling, in order to include all HTLCs in the view
Yes, the wrapper On the tapd side we parse both the logs of the local and remote chains, and mutate the external state accordingly.
I'm not sure in which cases the remote acked index and the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
If we are sending lots of HTLCs these two can likely be different all the time. We use the remote acked index to filter out the logs we received in
Cool yeah then returning as much info as needed does make sense, tho I'm not sure how you gonna filter updates there since
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah we use the I believe the |
||
| lc.updateLogs.Remote.logIndex, lc.updateLogs.Local.logIndex, | ||
GeorgeTsagk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| )) | ||
| } | ||
|
|
||
| // fetchHTLCView returns all the candidate HTLC updates which should be | ||
| // considered for inclusion within a commitment based on the passed HTLC log | ||
| // indexes. | ||
|
|
||
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 think it's better to not wrap the method, also need some docs explaining the indices used here.
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.
This part
is important as the wrapper
newAuxHtlcViewprovides us with a safe copy of the data as anAuxHtlcViewstruct.Sure can add more docs w.r.t the indices used, but let's first see if we agree on previous comment