-
Notifications
You must be signed in to change notification settings - Fork 44
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
feat(service): add open channel support #1044
Conversation
If this is supposed to close #909, it also should include an RPC call to set lnd's autopilot to true/false. Can also be done in a separate PR. |
861f3a2
to
a3a921a
Compare
This is ready for review, but I suggest we deal with #1055 first because this is built on top of this. Afterwards I'll rebase this against master. |
2d7c29a
to
888225a
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.
I've reviewed everything except the tests, made comments below. This will be a very handy feature, thanks!
if (this.identityPubKey !== getInfoResponse.getIdentityPubkey()) { | ||
newPubKey = getInfoResponse.getIdentityPubkey(); | ||
this.logger.debug(`pubkey is ${newPubKey}`); | ||
this.identityPubKey = newPubKey; | ||
newUris = getInfoResponse.getUrisList(); |
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 now we'll only update newUris
if the identity pub key changes. Maybe we should have a separate if statement that checks if the new uris list is different from the one we currently have and set newUris
if so.
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.
My thinking was that newUris
don't change at runtime so there's no need to add logic to compare array contents of newUris
.
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.
But they would change if lnd stops and starts while xud is running, right? In that case I'm thinking we'd want to update our lnd uris within xud.
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.
Would it be OK if I create an issue for it and deal with in a separate PR?
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 with me.
@sangaman Things left to do:
|
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.
Looks good, I don't think we should hold this up much longer. UnitConverter
is a good first step towards handling raiden currency amounts without hardcoding too.
const { peerPubKey, address } = uri; | ||
let timeout; | ||
try { | ||
timeout = setTimeout(() => { |
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 was thinking this might be a good spot to use Promise.race
- but after looking at this a bit more the grpc calls actually take an options parameter with a deadline
field to specify the max time for the call to complete. Doesn't have to be in this PR, but it'd be nice to use that (and maybe reuse it elsewhere down the road). I can create a quick followup PR perhaps.
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... perhaps. The benefit of having the timeout here would be a more clear error message.
I initially tried it with Promise.race
, but I ran into some issues (can't remember the specifics).
Still WIP and not ready for in depth review. Putting this out here for early feedback.
TODO:
LndClient
OpenChannel
gRPC callxucli openchannel [nodePubKey] [amount] [currency]