Skip to content

Add flags for if a channel is pub and funding txo in ChannelDetails #912

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

Conversation

TheBlueMatt
Copy link
Collaborator

No description provided.

@TheBlueMatt TheBlueMatt force-pushed the 2021-05-more-chan-info branch from 77bf352 to 1a3f65f Compare May 5, 2021 15:49
@TheBlueMatt
Copy link
Collaborator Author

Amended, only diff is the new changes in fuzz/

@jkczyz
Copy link
Contributor

jkczyz commented May 5, 2021

Amended, only diff is the new changes in fuzz/

The problem is in the normal router tests, too.

@codecov
Copy link

codecov bot commented May 5, 2021

Codecov Report

Merging #912 (62f466a) into main (c60543c) will increase coverage by 0.28%.
The diff coverage is 70.58%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #912      +/-   ##
==========================================
+ Coverage   90.57%   90.86%   +0.28%     
==========================================
  Files          59       59              
  Lines       29738    30808    +1070     
==========================================
+ Hits        26936    27993    +1057     
- Misses       2802     2815      +13     
Impacted Files Coverage Δ
lightning/src/ln/channelmanager.rs 88.22% <50.00%> (+4.25%) ⬆️
lightning/src/routing/router.rs 96.17% <100.00%> (+0.01%) ⬆️
lightning/src/ln/functional_tests.rs 96.87% <0.00%> (-0.16%) ⬇️
lightning/src/ln/msgs.rs 89.70% <0.00%> (+0.94%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c60543c...62f466a. Read the comment docs.

@TheBlueMatt TheBlueMatt force-pushed the 2021-05-more-chan-info branch from 3e284f5 to 43f306d Compare May 5, 2021 18:39
@TheBlueMatt
Copy link
Collaborator Author

Squashed without change.

Copy link

@ariard ariard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 43f306d modulo one comment.

/// channel is not currently being shut down. `funding_locked` message exchange implies the
/// required confirmation count has been reached (and we were connected to the peer at some
/// point after the funding transaction received enough confirmations).
pub is_confirmed: bool,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe call it is_usable if it matches exactly Channel method. "Confirmed" is a bit ambiguous for a) ongoing shutdown implies the channel has been confirmed and b) zero-conf channel don't expect any confirmation and are ready-to-go at creation ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is_usable is overloaded in a few places in our code already, and is a bit vague. We could add verbosity (like is_blockchain_confirmed or reached_target_blockchain_confirmations) or we could maybe refer to "locked" eg is_blockchain_locked. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe is_funding_locked would be sufficient as it covers having enough confirmations and having exchanged the funding_locked messages.

That said, I don't understand the argument against is_usable. It is only used in Channel as far as I can tell and is defined in the same manner as here. Where else is it used?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see there is ChannelManager::list_usable_channels which is checking against is_live. Perhaps that needs to be renamed instead. Or maybe is_live should really be is_usable? Then we'd need a new name for Channel::is_usable to something like is_funding_locked or maybe simply is_funded.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we rename list_usable_channels to list_live_channels or so? I like live/usable including "we're connected to the peer, in addition to is_funding_locked (which I'll rename this to).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I actually feel like "live" is more descriptive? Live, to me, is all about us being actively connected to the peer, ie the peer (and thus channel) are "live". What about renaming list_usable_channels to list_live_channels and leaving this as is_funding_locked (which is really just about the state of the funding transaction).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More descriptive in terms of functionality. Is something "live" also "usable"? Only if "live" includes "funding locked" which I don't think is obvious from the word "live" alone -- you need to read the docs to figure that out.

Regardless of which, my other point regarding Channel::is_usable still stands if something that is live is suppose to also be usable.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I guess I felt like "live" did capture that. I'm happy to go with "usable" if you feel strongly. Note that Channel isn't a public API, so we can rename it at will whenever :).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can be "actively connected to the peer" (i.e., "live") but the channel may not usable though, right? i.e., if the funding isn't locked.

Currently, the problem that I see is "live" is defined as a superset of "usable", but it seems like the opposite relation is true in actuality (i.e., when funding isn't locked). But really "live" has to do with the connection and "usable" has to do with the channel. So, maybe it should be is_live && is_funding_locked == is_usable?

Anyhow, it's not that I feel strongly on naming it list_live_channels, I'm just pointing out that there is inconsistency and ambiguity in the terminology that we are using. Some of the ambiguity is cleared up by the documentation (i.e. defining the meaning of "live") but is also contradictory (i.e., something "live" is usable but something just "usable" is not).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we currently have any code to indicate "connected to peer but channel is not yet confirmed". We could add that too, I suppose, but for now I agree we should pick love or usable and stick to it.

@TheBlueMatt
Copy link
Collaborator Author

Pushed a commit to rename ChannelDetails::is_live to is_usable. Hopefully this is ready to go now.

Copy link
Contributor

@jkczyz jkczyz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Internal renaming for consistency can come later.

@TheBlueMatt TheBlueMatt force-pushed the 2021-05-more-chan-info branch from 49ff0b2 to 1f3b990 Compare May 6, 2021 20:46
@TheBlueMatt TheBlueMatt force-pushed the 2021-05-more-chan-info branch from 1f3b990 to 62f466a Compare May 6, 2021 20:49
@TheBlueMatt
Copy link
Collaborator Author

Squashed without changes

$ git diff-tree -U1  49ff0b206512d0171215ca1440c1bb7d2a2cfad3 62f466a0
$

@ariard
Copy link

ariard commented May 6, 2021

Code Review ACK 62f466a

Agree with Jeff reasoning on terminology point live-vs-usable meaning.

@TheBlueMatt TheBlueMatt merged commit 7297e13 into lightningdevkit:main May 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants