Merge pull request #5112 from halseth/walletunlocker-mac-responsechan-close
lnd: close MacResponseChan when wallet is unlocked
This commit is contained in:
commit
419ad86209
18
lnd.go
18
lnd.go
@ -297,7 +297,9 @@ func Main(cfg *Config, lisCfg ListenerCfg, shutdownChan <-chan struct{}) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
walletInitParams WalletUnlockParams
|
walletInitParams = WalletUnlockParams{
|
||||||
|
MacResponseChan: make(chan []byte),
|
||||||
|
}
|
||||||
privateWalletPw = lnwallet.DefaultPrivatePassphrase
|
privateWalletPw = lnwallet.DefaultPrivatePassphrase
|
||||||
publicWalletPw = lnwallet.DefaultPublicPassphrase
|
publicWalletPw = lnwallet.DefaultPublicPassphrase
|
||||||
)
|
)
|
||||||
@ -415,10 +417,6 @@ func Main(cfg *Config, lisCfg ListenerCfg, shutdownChan <-chan struct{}) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now that the wallet password has been provided, transition the RPC
|
|
||||||
// state into Unlocked.
|
|
||||||
interceptorChain.SetWalletUnlocked()
|
|
||||||
|
|
||||||
var macaroonService *macaroons.Service
|
var macaroonService *macaroons.Service
|
||||||
if !cfg.NoMacaroons {
|
if !cfg.NoMacaroons {
|
||||||
// Create the macaroon authentication/authorization service.
|
// Create the macaroon authentication/authorization service.
|
||||||
@ -511,6 +509,16 @@ func Main(cfg *Config, lisCfg ListenerCfg, shutdownChan <-chan struct{}) error {
|
|||||||
interceptorChain.AddMacaroonService(macaroonService)
|
interceptorChain.AddMacaroonService(macaroonService)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Now that the wallet password has been provided, transition the RPC
|
||||||
|
// state into Unlocked.
|
||||||
|
interceptorChain.SetWalletUnlocked()
|
||||||
|
|
||||||
|
// Since calls to the WalletUnlocker service wait for a response on the
|
||||||
|
// macaroon channel, we close it here to make sure they return in case
|
||||||
|
// we did not return the admin macaroon above. This will be the case if
|
||||||
|
// --no-macaroons is used.
|
||||||
|
close(walletInitParams.MacResponseChan)
|
||||||
|
|
||||||
// With the information parsed from the configuration, create valid
|
// With the information parsed from the configuration, create valid
|
||||||
// instances of the pertinent interfaces required to operate the
|
// instances of the pertinent interfaces required to operate the
|
||||||
// Lightning Network Daemon.
|
// Lightning Network Daemon.
|
||||||
|
Loading…
Reference in New Issue
Block a user