Commit 10b8d571 authored by Jeromy's avatar Jeromy

fix race introduced in bitswap

License: MIT
Signed-off-by: default avatarJeromy <jeromyj@gmail.com>
parent 18c0cefd
...@@ -228,14 +228,14 @@ func (bs *Bitswap) HasBlock(ctx context.Context, blk *blocks.Block) error { ...@@ -228,14 +228,14 @@ func (bs *Bitswap) HasBlock(ctx context.Context, blk *blocks.Block) error {
default: default:
} }
bs.notifications.Publish(blk)
err := bs.tryPutBlock(blk, 4) // attempt to store block up to four times err := bs.tryPutBlock(blk, 4) // attempt to store block up to four times
if err != nil { if err != nil {
log.Errorf("Error writing block to datastore: %s", err) log.Errorf("Error writing block to datastore: %s", err)
return err return err
} }
bs.notifications.Publish(blk)
select { select {
case bs.newBlocks <- blk: case bs.newBlocks <- blk:
// send block off to be reprovided // send block off to be reprovided
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment