From e20a3e9f2c30e024bc8ad57953c42825372a39a5 Mon Sep 17 00:00:00 2001 From: "Owain G. Ainsworth" Date: Wed, 12 Feb 2014 15:33:52 +0000 Subject: [PATCH] Copy netaddresses in AddressCache instead of referencing them. While harmless, this prevents the race detector complaining when these are then used. Closes #94 --- addrmanager.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addrmanager.go b/addrmanager.go index fe54abfe..21ea3a71 100644 --- a/addrmanager.go +++ b/addrmanager.go @@ -714,7 +714,8 @@ func (a *AddrManager) AddressCache() []*btcwire.NetAddress { i := 0 // Iteration order is undefined here, but we randomise it anyway. for _, v := range a.addrIndex { - allAddr[i] = v.na + copyNa := *v.na + allAddr[i] = ©Na i++ } // Fisher-Yates shuffle the array