mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-02-21 22:11:41 +01:00
lnwallet/btcwallet: remove pruned interface methods
These methods are no longer a part of the interface. As a result, we can safely delete them.
This commit is contained in:
parent
a26367f3cb
commit
6290a520fd
1 changed files with 0 additions and 72 deletions
|
@ -250,78 +250,6 @@ func (b *BtcWallet) GetPrivKey(a btcutil.Address) (*btcec.PrivateKey, error) {
|
|||
return b.wallet.PrivKeyForAddress(a)
|
||||
}
|
||||
|
||||
// NewRawKey retrieves the next key within our HD key-chain for use within as a
|
||||
// multi-sig key within the funding transaction, or within the commitment
|
||||
// transaction's outputs.
|
||||
//
|
||||
// This is a part of the WalletController interface.
|
||||
func (b *BtcWallet) NewRawKey() (*btcec.PublicKey, error) {
|
||||
addr, err := b.wallet.NewAddress(defaultAccount,
|
||||
waddrmgr.WitnessPubKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return b.wallet.PubKeyForAddress(addr)
|
||||
}
|
||||
|
||||
// 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.
|
||||
func (b *BtcWallet) FetchRootKey() (*btcec.PrivateKey, error) {
|
||||
// Fetch the root address hash from the database, this is persisted
|
||||
// locally within the database, then used to obtain the key from the
|
||||
// wallet based on the address hash.
|
||||
var rootAddrHash []byte
|
||||
if err := walletdb.View(b.db, func(tx walletdb.ReadTx) error {
|
||||
lnBucket := tx.ReadBucket(lnNamespace)
|
||||
|
||||
rootAddrHash = lnBucket.Get(rootKey)
|
||||
return nil
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if rootAddrHash == nil {
|
||||
// Otherwise, we need to generate a fresh address from the
|
||||
// wallet, then stores its hash160 within the database so we
|
||||
// can look up the exact key later.
|
||||
if err := walletdb.Update(b.db, func(tx walletdb.ReadWriteTx) error {
|
||||
addrmgrNs := tx.ReadWriteBucket(waddrmgrNamespaceKey)
|
||||
addrs, err := b.wallet.Manager.NextExternalAddresses(addrmgrNs,
|
||||
defaultAccount, 1, waddrmgr.WitnessPubKey)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
rootAddr := addrs[0].Address()
|
||||
|
||||
lnBucket := tx.ReadWriteBucket(lnNamespace)
|
||||
|
||||
rootAddrHash = rootAddr.ScriptAddress()
|
||||
return lnBucket.Put(rootKey, rootAddrHash)
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
// With the root address hash obtained, generate the corresponding
|
||||
// address, then retrieve the managed address from the wallet which
|
||||
// will allow us to obtain the private key.
|
||||
rootAddr, err := btcutil.NewAddressWitnessPubKeyHash(rootAddrHash,
|
||||
b.netParams)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
priv, err := b.wallet.PrivKeyForAddress(rootAddr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return priv, nil
|
||||
}
|
||||
|
||||
// SendOutputs funds, signs, and broadcasts a Bitcoin transaction paying out to
|
||||
// the specified outputs. In the case the wallet has insufficient funds, or the
|
||||
// outputs are non-standard, a non-nil error will be be returned.
|
||||
|
|
Loading…
Add table
Reference in a new issue