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 cc45aba
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions chain/store/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -473,15 +473,15 @@ func (cs *ChainStore) LoadTipSet(tsk types.TipSetKey) (*types.TipSet, error) {
var eg errgroup.Group
cids := tsk.Cids()
blks := make([]*types.BlockHeader, 0, len(cids))
for _, c := range cids {
c := c
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 cc45aba

Please sign in to comment.