mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-02-22 22:25:24 +01:00
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:
parent
85b306bb48
commit
844cdba513
1 changed files with 4 additions and 4 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue