Skip to content
Snippets Groups Projects
Unverified Commit 483318ca authored by Angelo Capossele's avatar Angelo Capossele Committed by GitHub
Browse files

:bug: Fix consensus bug (#903)

parent d8c8cbb8
No related branches found
No related tags found
No related merge requests found
......@@ -34,10 +34,12 @@ type OpinionGivers map[identity.ID]OpinionGiver
// Query retrievs the opinions about the given conflicts and timestamps.
func (o *OpinionGiver) Query(ctx context.Context, conflictIDs []string, timestampIDs []string) (opinions vote.Opinions, err error) {
for i := 0; i < waitForStatement; i++ {
if o.view != nil {
opinions, err = o.view.Query(ctx, conflictIDs, timestampIDs)
if err == nil {
return opinions, nil
}
}
time.Sleep(time.Second)
}
......@@ -67,21 +69,16 @@ func OpinionGiverFunc() (givers []vote.OpinionGiver, err error) {
continue
}
if _, ok := opinionGiversMap[p.ID()]; !ok {
v := Registry().NodeView(p.ID())
opinionGiversMap[p.ID()] = &OpinionGiver{
id: p.ID(),
view: v,
view: nil,
}
}
opinionGiversMap[p.ID()].pog = &PeerOpinionGiver{p: p}
}
for _, v := range opinionGiversMap {
opinionGivers = append(opinionGivers, &OpinionGiver{
id: v.id,
view: v.view,
pog: v.pog,
})
opinionGivers = append(opinionGivers, v)
}
return opinionGivers, nil
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment