mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 01:43:16 +01:00
walletunlocker: re-create loader after unloading wallet
Because the wallet loader sets its internal database reference to nil when unloading a wallet, it cannot be loaded again in case of a remote DB such as etcd or postgres. To avoid running into a nil pointer panic we just re-create the loader as well before opening the wallet.
This commit is contained in:
parent
d04182f482
commit
ad0dbb1c15
@ -677,7 +677,13 @@ func (u *UnlockerService) LoadAndUnlock(password []byte,
|
||||
return nil, nil, dropErr
|
||||
}
|
||||
|
||||
// All looks good, let's now open the wallet again.
|
||||
// All looks good, let's now open the wallet again. The loader
|
||||
// was unloaded and might have removed its remote DB connection,
|
||||
// so let's re-create it as well.
|
||||
loader, err = u.newLoader(recoveryWindow)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
unlockedWallet, err = loader.OpenExistingWallet(password, false)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
|
Loading…
Reference in New Issue
Block a user