Skip to content
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

xPub support for loop out / autoloop out #605

Merged
merged 5 commits into from
Jul 27, 2023

Conversation

hieblmi
Copy link
Collaborator

@hieblmi hieblmi commented Jun 29, 2023

This PR addresses https://github.com/lightninglabs/nautilus/issues/1000

This PR enables loop out and autoloop out operations to sweep htlcs to addresses generated from an extended public key.

A precondition for using the loop client in this fashion is onboarding a xpub account in the backing lnd instance, e.g.
lncli wallet accounts import xpub... my_loop_account --address_type p2tr --master_key_fingerprint 0df50.

Loop outs can then be instructed to sweep to a new derived address from the specified account, e.g:
loop out --amt 10000000 --account my_loop_account --address_type p2tr.

To use this functionality with autoloop out one has to set the backing lnd account and address type via liquidity parameters for autoloop, e.g.
loop --network regtest setparams --autoloop=true --account=my_loop_account --account_addr_type=p2tr ...

@hieblmi hieblmi marked this pull request as draft June 29, 2023 15:26
@hieblmi hieblmi force-pushed the xpub-service branch 4 times, most recently from cd8c3f5 to b83fdba Compare July 7, 2023 07:31
cmd/loop/liquidity.go Outdated Show resolved Hide resolved
cmd/loop/liquidity.go Outdated Show resolved Hide resolved
cmd/loop/loopout.go Outdated Show resolved Hide resolved
cmd/loop/loopout.go Outdated Show resolved Hide resolved
cmd/loop/liquidity.go Outdated Show resolved Hide resolved
liquidity/liquidity.go Outdated Show resolved Hide resolved
looprpc/client.proto Outdated Show resolved Hide resolved
looprpc/client.proto Outdated Show resolved Hide resolved
liquidity/parameters.go Outdated Show resolved Hide resolved
@hieblmi hieblmi marked this pull request as ready for review July 10, 2023 16:21
Copy link
Member

@bhandras bhandras left a comment

Choose a reason for hiding this comment

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

Looking very good, great work @hieblmi 💯

Only nits and a question from my end.

looprpc/client.proto Show resolved Hide resolved
if err != nil {
return nil, err
}
}
}

addrType := walletrpc.AddressType_UNKNOWN
switch req.AccountAddrType {
Copy link
Member

Choose a reason for hiding this comment

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

nit: can be simplified to an if or a two-case switch.

looprpc/client.proto Show resolved Hide resolved
flagSet = true
}

if ctx.IsSet("account") != ctx.IsSet("account_addr_type") {
Copy link
Member

Choose a reason for hiding this comment

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

nit: validation could be before the params switch.

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 think I could also make it part of the switch itself.

cmd/loop/loopout.go Show resolved Hide resolved
@hieblmi hieblmi changed the title WIP: xPub support for loop out / autoloop out xPub support for loop out / autoloop out Jul 12, 2023
@hieblmi hieblmi force-pushed the xpub-service branch 2 times, most recently from 5924c35 to 155ac89 Compare July 19, 2023 14:18
looprpc/client.proto Show resolved Hide resolved
liquidity/parameters.go Show resolved Hide resolved
liquidity/parameters.go Show resolved Hide resolved
loopd/swapclient_server.go Outdated Show resolved Hide resolved
loopd/swapclient_server.go Outdated Show resolved Hide resolved
cmd/loop/liquidity.go Outdated Show resolved Hide resolved
looprpc/client.proto Show resolved Hide resolved
cmd/loop/liquidity.go Outdated Show resolved Hide resolved
Copy link
Member

@bhandras bhandras left a comment

Choose a reason for hiding this comment

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

LGTM, really nice work @hieblmi 🎉

Copy link
Member

@GeorgeTsagk GeorgeTsagk left a comment

Choose a reason for hiding this comment

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

tACK

LGTM 🌋

Copy link
Member

@sputn1ck sputn1ck left a comment

Choose a reason for hiding this comment

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

LGTM, great job!

Could you add a line to the release notes?

@@ -1,20 +1,19 @@
# Loop Client Release Notes
This file tracks release notes for the loop client.
Copy link
Member

@sputn1ck sputn1ck Jul 27, 2023

Choose a reason for hiding this comment

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

unneccessary line removals here and below

@GeorgeTsagk GeorgeTsagk merged commit a093316 into lightninglabs:master Jul 27, 2023
5 checks passed
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.

4 participants