diff --git a/lnwallet/btcwallet/btcwallet.go b/lnwallet/btcwallet/btcwallet.go index 6e9a929e..119f2efa 100644 --- a/lnwallet/btcwallet/btcwallet.go +++ b/lnwallet/btcwallet/btcwallet.go @@ -235,18 +235,21 @@ func (b *BtcWallet) GetPrivKey(a btcutil.Address) (*btcec.PrivateKey, error) { // // This is a part of the WalletController interface. func (b *BtcWallet) NewRawKey() (*btcec.PublicKey, error) { - nextAddr, err := b.wallet.Manager.NextExternalAddresses(defaultAccount, - 1, waddrmgr.WitnessPubKey) + addr, err := b.wallet.NewAddress(defaultAccount, + waddrmgr.WitnessPubKey) if err != nil { return nil, err } - pkAddr := nextAddr[0].(waddrmgr.ManagedPubKeyAddress) + pkAddr, err := b.wallet.Manager.Address(addr) + if err != nil { + return nil, err + } - return pkAddr.PubKey(), nil + return pkAddr.(waddrmgr.ManagedPubKeyAddress).PubKey(), nil } -// FetchRootKey returns a root key which is meanted to be used as an initial +// FetchRootKey returns a root key which is intended to be used as an initial // seed/salt to generate any Lightning specific secrets. // // This is a part of the WalletController interface. diff --git a/lnwallet/interface.go b/lnwallet/interface.go index 7b8bafb6..a5507b3b 100644 --- a/lnwallet/interface.go +++ b/lnwallet/interface.go @@ -131,6 +131,9 @@ type WalletController interface { // NewRawKey returns a raw private key controlled by the wallet. These // keys are used for the 2-of-2 multi-sig outputs for funding // transactions, as well as the pub key used for commitment transactions. + // + // NOTE: The wallet MUST watch for on-chain outputs created to a p2wpkh + // script using keys returned by this function. NewRawKey() (*btcec.PublicKey, error) // FetchRootKey returns a root key which will be used by the