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

[feature]: unify address creation behavior between BtcWalletKeyRing.DeriveNextKey and BtcWalletKeyRing.DeriveKey #8698

Open
jharveyb opened this issue Apr 26, 2024 · 0 comments
Labels
enhancement Improvements to existing features / behaviour P2 should be fixed if one has time wallet The wallet (lnwallet) which LND uses

Comments

@jharveyb
Copy link
Contributor

Is your feature request related to a problem? Please describe.

Discovered during tapd work and documented further here: lightninglabs/taproot-assets#883

The DeriveNextKey method stores a P2WKH address associated with the generated key:

addrs, err := scope.NextExternalAddresses(

Which is used elsewhere to look up KeyLocator info for a given pubkey when signing:

managedAddr, err := r.AddressInfo(addr)

DeriveKey does not store an address associate with a derived key:

path := waddrmgr.DerivationPath{

So such keys are omitted from RPC output like ListAccounts or ListAddresses. This means that RPC users cannot recover the KeyLocator for a key derived with DeriveKey (and the node itself will fail this recovery, so trying to sign with such a key will fail.)

Describe the solution you'd like

Update to DeriveKey that stores a matching P2WKH address, so these RPC calls have matching behavior.

Describe alternatives you've considered

Repeatedly calling DeriveNextKey until I get to the desired index, which seems strictly worse.

@jharveyb jharveyb added the enhancement Improvements to existing features / behaviour label Apr 26, 2024
@saubyk saubyk added wallet The wallet (lnwallet) which LND uses P2 should be fixed if one has time labels May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvements to existing features / behaviour P2 should be fixed if one has time wallet The wallet (lnwallet) which LND uses
Projects
None yet
Development

No branches or pull requests

2 participants