-
Notifications
You must be signed in to change notification settings - Fork 401
Expose in-flight claim balances #1034
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
Merged
TheBlueMatt
merged 11 commits into
lightningdevkit:main
from
TheBlueMatt:2021-07-maturing-claims
Sep 15, 2021
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
efa579b
Don't initialise Vecs being read with VecReadWrapper explicitly
TheBlueMatt ce479b6
Remove DynamicOutputP2WPKH ref in logger
ariard aaba0a2
Store to-self value in the current commitment tx in ChannelMonitor
TheBlueMatt 44e4867
Drop unused CounterpartyCommitmentTransaction::per_htlc HashMap
TheBlueMatt cd578b5
Rename CounterpartyCommitmentTransaction to Params as it is static
TheBlueMatt 73ee30d
Track the tx which spends our funding output in ChannelMonitor
TheBlueMatt c02b6a3
Track how our HTLCs are resolved on-chain persistently
TheBlueMatt f9febb0
Fix indentation in ChannelMonitor
TheBlueMatt 0090641
Expose the amount of funds available for claim in ChannelMonitor
TheBlueMatt a675886
Add an accessor to `ChainMonitor` to get the claimable balances
TheBlueMatt cae2123
Expand `ANTI_REORG_DELAY` docs to say its a library-wide assumption
TheBlueMatt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Oops, something went wrong.
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.
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.
Hmm, I'm fine with it if users are fine with it, but it seems odd to not relate ClaimableBalances to the channel they correspond to
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.
Hmm, I guess if users want it they can get it manually. Lets expose it as-is and see if anyone complains and we can deal with it then.
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.
Yeah, I tend to agree with @valentinewallace. Seems more intuitive / useful and would simplify the interface if a user asked for the balances of a particular channel rather than providing a filter. It would be easier for them to combine balances across all channels (if needed) than figure out which channel each balance belongs to.
What exactly was the use case that led to this request?
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.
You should be able to with the current interface?
This PR is targeted at clients who want to display a consistent user balance while a channel close is being confirmed on-chain. If you take the output of
ChannelManager::list_channels
and calculate live balances from those channels, and add them to the balances (of sensible type) in this PR, you can simply display that as the "user balance".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.
True, but (1) it isn't as intuitive since you need to provide all channel except the one you want and (2) it isn't efficient as you need to iterate through all ignored channels for each channel monitor. The alternative is to have the user provide a funding tx output for the channel of interest and perform a hash map lookup.
That said, given my comment below maybe this is moot.
Ah, I see. I think I may have been confused in that you'd typically use it for balances of closed channels. I guess
ChannelManager
won't have anyChannelDetails
for those? Happy to keep this as is if that's the case.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.
To be a bit more clear, I don't think we should approach it as "user queries on a per-channel basis", as that requires the user first asking the
ChainMonitor
for the list of channels they want to query for. I do think there's an argument to be had for exposing which channel each event corresponds to, but I'm not sure the right way to go about it, and I'm not 100% sure if users will care about that anyway. Open to ideas, or we can leave it as a future work.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.
Right! The idea is "I want to know my full balance, plus or minus cause balances in lightning are a bit confusing". The answer is "well, I have some off-chain balances, for which I'll ask ChannelManager and I have some on-chain balances, for which I mostly track myself, but there's some 'hiding' in ChainMonitor, which I'll have to ask it about". You don't want to double-count the not-yet-closed channels, so you tell
ChainMonitor
the list of things that you've already calculated as off-chain balances and let it tell you the rest.