mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-08 14:57:38 +02: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:
@@ -677,7 +677,13 @@ func (u *UnlockerService) LoadAndUnlock(password []byte,
|
|||||||
return nil, nil, dropErr
|
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)
|
unlockedWallet, err = loader.OpenExistingWallet(password, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
|
Reference in New Issue
Block a user