mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-29 15:11:09 +02:00
keychain: ensure we properly set the KeyLocator for keys from DeriveNextKey
In this commit, we fix a slight bug in the existing implementation of DeriveNextKey for btcwallet. Before this commit, we would only set the public key, and not also the derivation path. It's important that we also set the path information, as in the near future we'll be using the KeyDescriptors returned from this method to create static channel back ups. With these static backups, the key alone may be insufficient to re-derive the private key as we may need to fallback to brute forcing in order to re-derive the key as it's possible we add new key families in the future.
This commit is contained in:
@@ -83,7 +83,7 @@ const (
|
||||
// will vary per channel and use case) is the final element which allows us to
|
||||
// deterministically derive keys.
|
||||
type KeyLocator struct {
|
||||
// TODO(roasbeef); add the key scope as well??
|
||||
// TODO(roasbeef): add the key scope as well??
|
||||
|
||||
// Family is the family of key being identified.
|
||||
Family KeyFamily
|
||||
@@ -92,8 +92,8 @@ type KeyLocator struct {
|
||||
Index uint32
|
||||
}
|
||||
|
||||
// IsEmpty returns true if a KeyLocator is "empty". This may be the case where we
|
||||
// learn of a key from a remote party for a contract, but don't know the
|
||||
// IsEmpty returns true if a KeyLocator is "empty". This may be the case where
|
||||
// we learn of a key from a remote party for a contract, but don't know the
|
||||
// precise details of its derivation (as we don't know the private key!).
|
||||
func (k KeyLocator) IsEmpty() bool {
|
||||
return k.Family == 0 && k.Index == 0
|
||||
|
Reference in New Issue
Block a user