mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-30 15:40:59 +02:00
wtclient: make addr iterator panic safe
Ensure that calling Next twice in a row without first calling Reset is safe when the iterator is at the end of its list. Also alter the towerListIterator to call Reset after hitting an error on Next.
This commit is contained in:
@@ -145,6 +145,7 @@ func (t *towerListIterator) AddCandidate(candidate *Tower) {
|
||||
for {
|
||||
next, err := candidate.Addresses.Next()
|
||||
if err != nil {
|
||||
candidate.Addresses.Reset()
|
||||
break
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user