diff --git a/blockmanager.go b/blockmanager.go index 1b80d52d..7df808b3 100644 --- a/blockmanager.go +++ b/blockmanager.go @@ -413,13 +413,10 @@ func (b *blockManager) handleInvMsg(imsg *invMsg) { // blockHandler is the main handler for the block manager. It must be run // as a goroutine. It processes block and inv messages in a separate goroutine -// from the peer handlers so the block (MsgBlock) and tx (MsgTx) messages are -// handled by a single thread without needing to lock memory data structures. -// This is important because the block manager controls which blocks are needed -// and how the fetching should proceed. -// -// NOTE: Tx messages need to be handled here too. -// (either that or block and tx need to be handled in separate threads) +// from the peer handlers so the block (MsgBlock) messages are handled by a +// single thread without needing to lock memory data structures. This is +// important because the block manager controls which blocks are needed and how +// the fetching should proceed. func (b *blockManager) blockHandler() { candidatePeers := list.New() out: @@ -480,7 +477,9 @@ func (b *blockManager) handleNotifyMsg(notification *btcchain.Notification) { case btcchain.NTBlockAccepted: // Don't relay if we are not current. Other peers that are // current should already know about it. - + // TODO(davec): This should really be over in RelayInventory + // in server to stop all relays, but chain is not concurrent + // safe at this time, so call it here to single thread access. if !b.blockChain.IsCurrent() { return } diff --git a/server.go b/server.go index 8b726c3b..90d6d395 100644 --- a/server.go +++ b/server.go @@ -153,7 +153,7 @@ func (s *server) handleBanPeerMsg(banned map[string]time.Time, p *peer) { // known to have it. It is invoked from the peerHandler goroutine. func (s *server) handleRelayInvMsg(peers *list.List, iv *btcwire.InvVect) { // TODO(davec): Don't relay inventory during the initial block chain - // download. + // download. Move the check out of the block manager. // Loop through all connected peers and relay the inventory to those // which are not already known to have it.