@cryptotaxi247 / kubo / commits / 2b60b641c

fix: check blockstore before adding task

addresses https://github.com/jbenet/go-ipfs/pull/438#discussion_r21953742 License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>

Brian Tiger Chow committed Dec 16, 2014 at 23:54 UTC 2b60b641c4dc031f246293d63f03ed52d15fe65d
1 file changed +4 -2
exchange/bitswap/decision/engine.go
+4 -2
@@ -122,8 +122,10 @@ func (e *Engine) MessageReceived(p peer.Peer, m bsmsg.BitSwapMessage) error {
122 e.peerRequestQueue.Remove(entry.Key, p)
123 } else {
124 l.Wants(entry.Key, entry.Priority)
125 - newWorkExists = true
126 - e.peerRequestQueue.Push(entry.Key, entry.Priority, p)
125 + if exists, err := e.bs.Has(entry.Key); err == nil && exists {
126 + newWorkExists = true
127 + e.peerRequestQueue.Push(entry.Key, entry.Priority, p)
128 + }
129 }
130 }
131