server: start htlcSwitch before chainArb

This commit is contained in:
yyforyongyu
2022-01-30 12:14:37 +08:00
parent 1aaa1d89bb
commit 72548ea463
2 changed files with 13 additions and 6 deletions

View File

@ -36,6 +36,10 @@
could result in an "invoice too large" error when creating invoices. Hints could result in an "invoice too large" error when creating invoices. Hints
are now properly limited to our maximum of 20. are now properly limited to our maximum of 20.
* [Fixed an edge case where the lnd might be stuck at starting due to channel
arbitrator relying on htlcswitch to be started
first](https://github.com/lightningnetwork/lnd/pull/6214).
## Misc ## Misc
* [An example systemd service file](https://github.com/lightningnetwork/lnd/pull/6033) * [An example systemd service file](https://github.com/lightningnetwork/lnd/pull/6033)

View File

@ -1777,6 +1777,15 @@ func (s *server) Start() error {
} }
cleanup = cleanup.add(s.fundingMgr.Stop) cleanup = cleanup.add(s.fundingMgr.Stop)
// htlcSwitch must be started before chainArb since the latter
// relies on htlcSwitch to deliver resolution message upon
// start.
if err := s.htlcSwitch.Start(); err != nil {
startErr = err
return
}
cleanup = cleanup.add(s.htlcSwitch.Stop)
if err := s.chainArb.Start(); err != nil { if err := s.chainArb.Start(); err != nil {
startErr = err startErr = err
return return
@ -1807,12 +1816,6 @@ func (s *server) Start() error {
} }
cleanup = cleanup.add(s.sphinx.Stop) cleanup = cleanup.add(s.sphinx.Stop)
if err := s.htlcSwitch.Start(); err != nil {
startErr = err
return
}
cleanup = cleanup.add(s.htlcSwitch.Stop)
if err := s.chanStatusMgr.Start(); err != nil { if err := s.chanStatusMgr.Start(); err != nil {
startErr = err startErr = err
return return