routing/chainview: Fix data race in block disconnected callback.

This commit is contained in:
Jim Posen authored and Olaoluwa Osuntokun committed 2017-09-29 13:53:02 -07:00
1 parent 3db8703e13
commit d8a2ed27b8
1 file changed
+4 -2
+4 -2
View File
@@ -178,11 +178,13 @@ func (c *CfFilteredChainView) onFilteredBlockConnected(height int32,
func (c *CfFilteredChainView) onFilteredBlockDisconnected(height int32, func (c *CfFilteredChainView) onFilteredBlockDisconnected(height int32,
header *wire.BlockHeader) { header *wire.BlockHeader) {
go func() { filteredBlock := &FilteredBlock{
c.staleBlocks <- &FilteredBlock{
Hash: header.BlockHash(), Hash: header.BlockHash(),
Height: uint32(height), Height: uint32(height),
} }
go func() {
c.staleBlocks <- filteredBlock
}() }()
} }