-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[RFC] improving error messages for debug purpuse #8740
base: master
Are you sure you want to change the base?
[RFC] improving error messages for debug purpuse #8740
Conversation
Important Review skippedAuto reviews are limited to specific labels. Labels to auto review (1)
Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
thanks for the PR - agree that this would be useful info.
Left some suggestions - main one being that I dont think this is the best spot for this log line
e509740
to
672242b
Compare
Trivial Rebased on master, and should be ready to another review @ellemouton |
func hasFeatures(local, remote *lnwire.FeatureVector, | ||
features ...lnwire.FeatureBit) bool { | ||
features ...lnwire.FeatureBit) (bool, []lnwire.FeatureBit) { |
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.
the only thing is that this is a mixture of the missing features... not sure how useful that is. So perhaps return 2 slices here? one for local and one for remote?
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 thought this too, but I think that this message is for debugging, so we can double-check what kind of feature we are sending with the one that it is inside the error message.
However, if you think that returns the remote
and local
features in the error message I can add it too, because it is a good idea anyway.
Waiting for your answer :)
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.
yes the thing we use the return values for happens to just be for logging, but I think we want the return values to be meaningful & useful in a code context too.
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.
Sounds good! So going to apply this change
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.
@ellemouton just keeping the history clean to review I added a fixup
commit with the implementation of what you are suggesting 3c4caad
let me know if you have a better idea on how to implement it
@@ -360,6 +360,7 @@ func hasFeatures(local, remote *lnwire.FeatureVector, | |||
|
|||
for _, feature := range features { |
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.
note that the commit message does not match the commit contents
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
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.
Ok I now understand, and I think with 3c4caad the commit body is in line with the code, is it? or do we need a rewording there to?
cbccd1c
to
5b720e1
Compare
@vincenzopalazzo, remember to re-request review from reviewers when ready |
5abb01f
to
a1e4e44
Compare
This commit modify the hasFeature functio in the funding package to communicate which feature (from either the local or remote node) is missing during feature negotiation. [skip ci] Co-Developed-by: @ellemouton Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
a1e4e44
to
83f10f6
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.
Thank you for the PR! Could you remove the [skip ci]
flag in the commit message to let the CI run?
@@ -94,15 +95,16 @@ func explicitNegotiateCommitmentType(channelType lnwire.ChannelType, local, | |||
lnwire.AnchorsZeroFeeHtlcTxRequired, | |||
lnwire.StaticRemoteKeyRequired, | |||
): | |||
if !hasFeatures( | |||
if ok, missing := hasFeatures( |
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.
nit: can instead do, same for other places
ok, missing := hasFeatures(
...
)
if !ok {
...
}
@@ -353,15 +367,41 @@ func implicitNegotiateCommitmentType(local, | |||
return &chanType, lnwallet.CommitmentTypeLegacy | |||
} | |||
|
|||
// hasFeatures determines whether a set of features is supported by both the set | |||
// of local and remote features. | |||
// FeaturesBitDiff - Keeps track of the feature bit |
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.
// FeaturesBitDiff - Keeps track of the feature bit | |
// FeaturesBitDiff keeps track of the feature bit |
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.
We usually use full sentences for the docs.
Change Description
While debugging bug reports like ElementsProject/lightning#7221 it is useful to know from the info log that there is some problem of features between the two peers. In This way, the debugging is faster and helps to save time
P.S: not sure I am using the log in the correct way, sorry!