-
Notifications
You must be signed in to change notification settings - Fork 103
Add new subservers
package
#516
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
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.
Great work on this, @ellemouton and @positiveblue! Nothing major from my end, except for the missing additional itests around startup (and the new RPCs that were added).
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 taking this over! Great idea to split up the original PR a bit 👍 🙏
97be6f3
to
db9d2d4
Compare
itest need to be added |
db9d2d4
to
bab21fb
Compare
@guggero: 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.
Thanks for the update, LGTM 🎉
Needs a rebase though. |
bab21fb
to
2539ccb
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.
Looking good!
a few nits & questions. The main thing that I think should be changed here is that we should keep the behaviour of the Litd startup process the same. In otherwords, if one of the subsystems fail to start, Lit should fail to start. We can change this behaviour once we add the 'status server' 👍
firewall/rule_enforcer.go
Outdated
mid "github.com/lightninglabs/lightning-terminal/rpcmiddleware" | ||
"github.com/lightninglabs/lightning-terminal/rules" | ||
"github.com/lightninglabs/lightning-terminal/session" | ||
"github.com/lightninglabs/lightning-terminal/subservers" |
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.
what is the main reason for moving the permissions logic? cause now the subserver
package manages LiT's permissions which is kinda strange to me. Perhaps the permissions manager can remain where it is and then subservers can register their permissions with 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.
Good point, the main idea was for the permission manager to be able to get and returns SubServerName(s)
typed strings. But it may be worth keeping the permissions where they were + use simple strings
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.
ah ok I see - so moving things to avoid the circular dependency. But yeah, perhaps in this case a little bit of copying is better than the large code shift.
interested to hear what @guggero 's opinion is on this 🙏
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'd probably also go with having a separate list of the subserver names and keeping the permissions where they are.
e5044d9
to
10edc66
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.
Great stuff!!! 🚀 tACK
LGTM once the perms comment has been addressed & also think we can remove all the status related TODOs
terminal.go
Outdated
@@ -430,30 +456,49 @@ func (g *LightningTerminal) Run() error { | |||
case <-readyChan: | |||
|
|||
case err := <-g.errQueue.ChanOut(): | |||
// TODO(positiveblue): set error status for lnd. |
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.
should we maybe not scatter all the TODOs for the status stuff? think it only makes sense if there is actually a status server
a19c679
to
ee29c85
Compare
Add a `started` variable to the rpcProxy that is used to indicate if the proxy is ready to handle requests. This is because currently the webserver is dependent on the rpcProxy to start and we want to be able to start the webserver without being dependent on the rpcProxy so that it can be used to handle status requests in a future commit. So with this commit, we can now saftely start the webserver earlier on and then if requests come through for the rpcProxy, an error will be displayed to the user.
Remove the responsibility of creating an LND connection from the rpcProxy and instead let the main LightningTerminal struct handle it. All the lnd-connection specific functions are also moved into their own file.
A pure refactor commit. It just splits various parts of the main Run function out into helper functions in order to more clearly show the steps taken to set up LiT.
Since all the relevant dependancies have been accouted for, we know move the starting of the main webserver to earlier on in the Run function. This is in preparation for later when the webserver will be "always-on" and will be used to server status information about the rest of the LiT subservers.
Note: substitutes part of the work in #442, server status will be added in a different PR