lnwallet: remove need for lnwallet to have access to the private key

This paves the way for lnd to work with hardware wallets, in which case it will not have access to the private key.
This commit is contained in:
CirroStorm authored and Olaoluwa Osuntokun committed 2018-09-27 20:58:46 -07:00
1 parent 6afee3d099
commit f594a57c94
4 files changed
+9 -19

No files matched your search

+4 -8
View File
@@ -9,7 +9,6 @@ import (
"sync"
"time"
"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/txscript"
@@ -255,15 +254,12 @@ func (b *BtcWallet) NewAddress(t lnwallet.AddressType, change bool) (btcutil.Add
return b.wallet.NewAddress(defaultAccount, keyScope)
}
// GetPrivKey retrieves the underlying private key associated with the passed
// address. If the we're unable to locate the proper private key, then a
// non-nil error will be returned.
// IsOurAddress checks if the passed address belongs to this wallet
//
// This is a part of the WalletController interface.
func (b *BtcWallet) GetPrivKey(a btcutil.Address) (*btcec.PrivateKey, error) {
// Using the ID address, request the private key corresponding to the
// address from the wallet's address manager.
return b.wallet.PrivKeyForAddress(a)
func (b *BtcWallet) IsOurAddress(a btcutil.Address) bool {
result, err := b.wallet.HaveAddress(a)
return result && (err == nil)
}
// SendOutputs funds, signs, and broadcasts a Bitcoin transaction paying out to