From d8a2ed27b89c1b9c1d436eb93e0d7a9e924f15d2 Mon Sep 17 00:00:00 2001 From: Jim Posen Date: Wed, 27 Sep 2017 20:13:02 -0700 Subject: [PATCH] routing/chainview: Fix data race in block disconnected callback. --- routing/chainview/neutrino.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/routing/chainview/neutrino.go b/routing/chainview/neutrino.go index bb3e51ca..15d415b9 100644 --- a/routing/chainview/neutrino.go +++ b/routing/chainview/neutrino.go @@ -178,11 +178,13 @@ func (c *CfFilteredChainView) onFilteredBlockConnected(height int32, func (c *CfFilteredChainView) onFilteredBlockDisconnected(height int32, header *wire.BlockHeader) { + filteredBlock := &FilteredBlock{ + Hash: header.BlockHash(), + Height: uint32(height), + } + go func() { - c.staleBlocks <- &FilteredBlock{ - Hash: header.BlockHash(), - Height: uint32(height), - } + c.staleBlocks <- filteredBlock }() }