Return nil in GetAddress if no addresses present.
Honestly thought we already did this, but turns out no.
This commit is contained in:
parent
ad12d10503
commit
70f15f434f
1 changed files with 4 additions and 0 deletions
|
@ -764,6 +764,10 @@ func NetAddressKey(na *btcwire.NetAddress) string {
|
|||
// have not been used recently and should not pick 'close' addresses
|
||||
// consecutively.
|
||||
func (a *AddrManager) GetAddress(class string, newBias int) *knownAddress {
|
||||
if a.NumAddresses() == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Protect concurrent access.
|
||||
a.mtx.Lock()
|
||||
defer a.mtx.Unlock()
|
||||
|
|
Loading…
Reference in a new issue