mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-31 16:55:13 +02:00
watchtower: allow removal during session negotiation
In this commit, the bug demonstrated in the previous commit is fixed. The locking capabilities of the AddressIterator are used to lock addresses if they are being used for session negotiation. So now, when a request comes through to remove a tower address then a check is first done to ensure that the address is not currently in use. If it is not, then the request can go through.
This commit is contained in:
@@ -155,6 +155,10 @@ func (t *towerListIterator) RemoveCandidate(candidate wtdb.TowerID,
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
if tower.Addresses.HasLocked() {
|
||||
return ErrAddrInUse
|
||||
}
|
||||
|
||||
delete(t.candidates, candidate)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user