From 70f15f434f4c2edd7524dc891f63fa493b8184a6 Mon Sep 17 00:00:00 2001 From: "Owain G. Ainsworth" Date: Wed, 2 Oct 2013 20:18:13 +0100 Subject: [PATCH] Return nil in GetAddress if no addresses present. Honestly thought we already did this, but turns out no. --- addrmanager.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addrmanager.go b/addrmanager.go index a4da1b83..25eed9a8 100644 --- a/addrmanager.go +++ b/addrmanager.go @@ -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()