From 6290a520fd94ed8812f43bde8cf389f64c5fa62e Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Sat, 17 Feb 2018 15:02:16 -0800 Subject: [PATCH] lnwallet/btcwallet: remove pruned interface methods These methods are no longer a part of the interface. As a result, we can safely delete them. --- lnwallet/btcwallet/btcwallet.go | 72 --------------------------------- 1 file changed, 72 deletions(-) diff --git a/lnwallet/btcwallet/btcwallet.go b/lnwallet/btcwallet/btcwallet.go index 2855d319..b446974b 100644 --- a/lnwallet/btcwallet/btcwallet.go +++ b/lnwallet/btcwallet/btcwallet.go @@ -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.