mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-03 03:29:50 +02:00
server: produces a channel backup upon shutdown
This is needed to keep channel.backup up-to-date if the node is stopped.
This commit is contained in:
parent
fb397c11f1
commit
29946df4e5
17
server.go
17
server.go
@ -2504,6 +2504,23 @@ func (s *server) Stop() error {
|
||||
if err := s.htlcNotifier.Stop(); err != nil {
|
||||
srvrLog.Warnf("failed to stop htlcNotifier: %v", err)
|
||||
}
|
||||
|
||||
// Update channel.backup file. Make sure to do it before
|
||||
// stopping chanSubSwapper.
|
||||
singles, err := chanbackup.FetchStaticChanBackups(
|
||||
s.chanStateDB, s.addrSource,
|
||||
)
|
||||
if err != nil {
|
||||
srvrLog.Warnf("failed to fetch channel states: %v",
|
||||
err)
|
||||
} else {
|
||||
err := s.chanSubSwapper.ManualUpdate(singles)
|
||||
if err != nil {
|
||||
srvrLog.Warnf("Manual update of channel "+
|
||||
"backup failed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
if err := s.chanSubSwapper.Stop(); err != nil {
|
||||
srvrLog.Warnf("failed to stop chanSubSwapper: %v", err)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user