Merge pull request #831 from filecoin-project/fix/multiple-miners

fix including multiple blocks from the same miner in a tipset
This commit is contained in:
Łukasz Magiera 2019-12-10 12:15:11 +01:00 committed by GitHub
commit c472f7cfbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -490,6 +490,7 @@ func (cs *ChainStore) expandTipset(b *types.BlockHeader) (*types.TipSet, error)
return types.NewTipSet(all) return types.NewTipSet(all)
} }
inclMiners := map[address.Address]bool{b.Miner: true}
for _, bhc := range tsets { for _, bhc := range tsets {
if bhc == b.Cid() { if bhc == b.Cid() {
continue continue
@ -500,8 +501,14 @@ func (cs *ChainStore) expandTipset(b *types.BlockHeader) (*types.TipSet, error)
return nil, xerrors.Errorf("failed to load block (%s) for tipset expansion: %w", bhc, err) return nil, xerrors.Errorf("failed to load block (%s) for tipset expansion: %w", bhc, err)
} }
if inclMiners[h.Miner] {
log.Warnf("Have multiple blocks from miner %s at height %d in our tipset cache", h.Miner, h.Height)
continue
}
if types.CidArrsEqual(h.Parents, b.Parents) { if types.CidArrsEqual(h.Parents, b.Parents) {
all = append(all, h) all = append(all, h)
inclMiners[h.Miner] = true
} }
} }