Merge pull request #7939 from filecoin-project/asr/migration-autobatch

fix: blockstore: Add missing locks to autobatch::Get()
This commit is contained in:
Aayush Rajasekaran 2022-01-12 17:55:31 -05:00 committed by GitHub
commit ae12c70afe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -162,6 +162,8 @@ func (bs *AutobatchBlockstore) Get(ctx context.Context, c cid.Cid) (block.Block,
return blk, err return blk, err
} }
bs.stateLock.Lock()
defer bs.stateLock.Unlock()
v, ok := bs.flushingBatch.blockMap[c] v, ok := bs.flushingBatch.blockMap[c]
if ok { if ok {
return v, nil return v, nil