From bbc616c70c66d385801ef1629e42a80698024f84 Mon Sep 17 00:00:00 2001 From: whyrusleeping Date: Tue, 10 Dec 2019 12:07:07 +0100 Subject: [PATCH] fix including multiple blocks from the same miner in a tipset --- chain/store/store.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/chain/store/store.go b/chain/store/store.go index b371ec6e1..69816c5a2 100644 --- a/chain/store/store.go +++ b/chain/store/store.go @@ -490,6 +490,7 @@ func (cs *ChainStore) expandTipset(b *types.BlockHeader) (*types.TipSet, error) return types.NewTipSet(all) } + inclMiners := map[address.Address]bool{b.Miner: true} for _, bhc := range tsets { if bhc == b.Cid() { 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) } + 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) { all = append(all, h) + inclMiners[h.Miner] = true } }