[feature]: unify address creation behavior between BtcWalletKeyRing.DeriveNextKey
and BtcWalletKeyRing.DeriveKey
#8698
Labels
enhancement
Improvements to existing features / behaviour
P2
should be fixed if one has time
wallet
The wallet (lnwallet) which LND uses
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:
lnd/keychain/btcwallet.go
Line 164 in 675ae6e
Which is used elsewhere to look up
KeyLocator
info for a given pubkey when signing:lnd/lnwallet/rpcwallet/rpcwallet.go
Line 973 in 675ae6e
DeriveKey does not store an address associate with a derived key:
lnd/keychain/btcwallet.go
Line 230 in 675ae6e
So such keys are omitted from RPC output like
ListAccounts
orListAddresses
. This means that RPC users cannot recover theKeyLocator
for a key derived withDeriveKey
(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.The text was updated successfully, but these errors were encountered: