From cb9a1dbb4fdee46d7ce9e669a07b3416194c403e Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Fri, 1 Dec 2017 23:32:46 -0500 Subject: [PATCH] p2p/trust: lock on Copy() --- p2p/trust/metric.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/p2p/trust/metric.go b/p2p/trust/metric.go index 3b4c6dd1..beb462b2 100644 --- a/p2p/trust/metric.go +++ b/p2p/trust/metric.go @@ -234,6 +234,8 @@ func (tm *TrustMetric) NextTimeInterval() { // Copy returns a new trust metric with members containing the same values func (tm *TrustMetric) Copy() *TrustMetric { + tm.mtx.Lock() + defer tm.mtx.Unlock() if tm == nil { return nil }