lnwallet/btcwallet: unlock wallet during startup, not creation

This commit modifies the way we go about unlocking the wallet. With the
latest changes to the API of btcwallet, we can on longer directly
access the waddrmgr struct. As a result, we’re now forced to go
_directly_ via the wallet to unlock the waddrmgr. The root
LightingWallet has been modified to not request the root key until we
finish starting the underlying wallet, so we can unlock the wallet in
the Start() method.
This commit is contained in:
Olaoluwa Osuntokun 2017-04-23 19:17:54 -07:00
parent 85b306bb48
commit 844cdba513
No known key found for this signature in database
GPG key ID: 9CC5B105D03521A2

View file

@ -94,10 +94,6 @@ func New(cfg *Config) (*BtcWallet, error) {
}
}
if err := wallet.Manager.Unlock(cfg.PrivatePass); err != nil {
return nil, err
}
// Create a special websockets rpc client for btcd which will be used
// by the wallet for notifications, calls, etc.
rpcc, err := chain.NewRPCClient(cfg.NetParams, cfg.RPCHost,
@ -139,6 +135,10 @@ func (b *BtcWallet) Start() error {
// current main chain.
b.wallet.SynchronizeRPC(b.rpc)
if err := b.wallet.Unlock(b.cfg.PrivatePass, nil); err != nil {
return err
}
return nil
}