-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Fixing the current state update when lncli debuglevel and lncli setmccfg are called #8857
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
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 Configuration File (
|
|
Hello everyone, the code is working as expected! But the changes made with Line 3164 in 71ba355
|
Edit: |
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 work. I do think the commit does not follow the guidelines:
https://github.com/lightningnetwork/lnd/blob/master/docs/code_contribution_guidelines.md#ideal-git-commit-structure
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.
utconceptack
|
Can you rebase the PR to get rid of the merge commits please? Then I'll take another look. |
Sorry about that mess! I'm learning a lot of things at the same time and the git collaboration process is one of them! Rebase done, thank you for pointing it. |
|
Thanks for the rebase. Looks a bit better now. That means each commit should be a small but internally consistent (e.g. each commit compiles on its own) change, with a clear description (e.g. in the commit message or code comments) of why the change is needed and why it's done in this specific way. And each commit should be in a logical order that makes sense to the reviewer. What you want to avoid is that the commits show different iterations of things you tried or changes during the review itself. So that a new reviewer looking at the code doesn't have to look at all the different stages the code went through and can just take in the current state. Don't worry if you don't get that perfect for the first couple of pull requests, great commit crafting is a hard skill to learn and an art form in itself. So long story short: can you please update your PR so it only has 3 or 4 commits? You'll probably want to use interactive rebase to achieve that. Here are a couple of links that should get you started: |
Thank you very much for investing time in providing such valuable guidance. I'll be working on it today and let you know when ready. |
d07f4b1 to
c8fedca
Compare
Done ... only 3 commits! |
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 and commit structure looks pretty good now! Mostly nits remaining.
1bc5103 to
4ec62b1
Compare
|
@Abdulkbk: review reminder |
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
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 work! My main comment is about ensuring that we account for all MC config values here and not just the estimator
routing/missioncontrol.go
Outdated
| m.estimator = cfg.Estimator | ||
|
|
||
| // Callback function to update the estimator value on main cfg. | ||
| m.updateEstimator(cfg.Estimator) |
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.
for call backs, we should not assume that they are necessarily set. So we should do a nil check here before invoking it
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.
for example, this commit by itself does not set UpdateEstimator and so this would panic as is
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.
or you can avoid the nil check by instead having:
UpdateEstimator fn.Option[func(estimator Estimator)]
and then:
m.cfg.UpdateEstimator.WhenSome(func(f func(estimator Estimator)) {
f(cfg.Estimator)
})
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'll be addressing the nil check ... thanks!
Thank you for your careful review. |
|
@MPins - thanks for the quick updates! I've unresolved one comment cause it is unaddressed:
I didnt just mean the name of the call-back. I meant the actual behaviour too. It should take in the This also needs a rebase as there is a merge conflict |
b10d561 to
46c64b1
Compare
cd7d415 to
a3b5924
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.
almost there 🙏
Also just note that 0.18.3 has now shipped so we will need to move the release notes over to a new doc. Currently still unsure if this will be 0.18.4 or 0.19.0. But lets just focus on getting this fully approved first & then we can worry about which doc to put the release notes in :)
|
@MPins can you rebase & add release notes to 0.19 in the mean time so that the CI can run pls 🙏 |
NewMissionControl propagate the callback function defined on server.go and SetConfig call it to update the infos on main cfg.
This callback function is called whenever the command `lncli setmccfg` is used to change the routing settings.
Thank you. Done. |
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! 🛠️
Fixes #8793
modified: rpcserver.go
modified: server.go
modified: routing/missioncontrol.go
Change Description
Changed the DebugLevel function to start updating the main cfg DebugLevel variable.
Created the function UpdateRoutingConfig to just update the main cfg values, this function is a callback function propagated by NewMissionControl function called when creating a new server on server.go. And finally, call the callback function on SetConfig on routing/missioncontrol.go
Steps to Test
After running LND with the wallet unlocked, send the lncli commands to change the debuglevel and estimator and check if they are updated unsing 'getdebuginfo'.
Pull Request Checklist
Testing
Code Style and Documentation
[skip ci]in the commit message for small changes.📝 Please see our Contribution Guidelines for further guidance.