Merge pull request #3313 from wpaulino/neutrino-cleanup-panic
lnd: prevent panic on nil neutrino cleanup
This commit is contained in:
commit
a7152efca4
@ -713,6 +713,7 @@ func initNeutrinoBackend(chainDir string) (*neutrino.ChainService, func(), error
|
|||||||
cfg.NeutrinoMode.AssertFilterHeader,
|
cfg.NeutrinoMode.AssertFilterHeader,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
db.Close()
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -754,6 +755,7 @@ func initNeutrinoBackend(chainDir string) (*neutrino.ChainService, func(), error
|
|||||||
|
|
||||||
neutrinoCS, err := neutrino.NewChainService(config)
|
neutrinoCS, err := neutrino.NewChainService(config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
db.Close()
|
||||||
return nil, nil, fmt.Errorf("unable to create neutrino light "+
|
return nil, nil, fmt.Errorf("unable to create neutrino light "+
|
||||||
"client: %v", err)
|
"client: %v", err)
|
||||||
}
|
}
|
||||||
|
2
lnd.go
2
lnd.go
@ -203,10 +203,10 @@ func Main() error {
|
|||||||
neutrinoBackend, neutrinoCleanUp, err := initNeutrinoBackend(
|
neutrinoBackend, neutrinoCleanUp, err := initNeutrinoBackend(
|
||||||
mainChain.ChainDir,
|
mainChain.ChainDir,
|
||||||
)
|
)
|
||||||
defer neutrinoCleanUp()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
defer neutrinoCleanUp()
|
||||||
neutrinoCS = neutrinoBackend
|
neutrinoCS = neutrinoBackend
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user