mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-27 22:21:18 +02:00
watchtower: prevent removal of last tower addr
This addresses a potential panic when a tower has one of its candidate sessions chosen, but its only reachable address was removed by a user-initiated RPC before the fact.
This commit is contained in:
@@ -101,6 +101,9 @@ func (m *ClientDB) RemoveTower(pubKey *btcec.PublicKey, addr net.Addr) error {
|
||||
|
||||
if addr != nil {
|
||||
tower.RemoveAddress(addr)
|
||||
if len(tower.Addresses) == 0 {
|
||||
return wtdb.ErrLastTowerAddr
|
||||
}
|
||||
m.towers[tower.ID] = tower
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user