Skip to content

Commit

Permalink
routing/chainview: Fix data race in block disconnected callback.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim Posen authored and Roasbeef committed Sep 29, 2017
1 parent 3db8703 commit d8a2ed2
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions routing/chainview/neutrino.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}()
}

Expand Down

0 comments on commit d8a2ed2

Please sign in to comment.