Skip to content

Commit

Permalink
fix: unsafe append in LoadTipSet
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkmc committed Sep 28, 2020
1 parent 6b16d48 commit cfe6f59
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions chain/store/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -472,16 +472,16 @@ func (cs *ChainStore) LoadTipSet(tsk types.TipSetKey) (*types.TipSet, error) {
// Fetch tipset block headers from blockstore in parallel
var eg errgroup.Group
cids := tsk.Cids()
blks := make([]*types.BlockHeader, 0, len(cids))
for _, c := range cids {
c := c
blks := make([]*types.BlockHeader, len(cids))
for i, c := range cids {
i, c := i, c
eg.Go(func() error {
b, err := cs.GetBlock(c)
if err != nil {
return xerrors.Errorf("get block %s: %w", c, err)
}

blks = append(blks, b)
blks[i] = b
return nil
})
}
Expand Down

0 comments on commit cfe6f59

Please sign in to comment.