diff --git a/snow/consensus/avalanche/topological.go b/snow/consensus/avalanche/topological.go index 25456b4f61c..6c7d3bfb31c 100644 --- a/snow/consensus/avalanche/topological.go +++ b/snow/consensus/avalanche/topological.go @@ -498,8 +498,7 @@ func (ta *Topological) update(ctx context.Context, vtx Vertex) error { // reissued. ta.orphans.Remove(vtxID) - switch vtx.Status() { - case choices.Accepted: + if vtx.Status() == choices.Accepted { ta.preferred.Add(vtxID) // I'm preferred ta.virtuous.Add(vtxID) // Accepted is defined as virtuous @@ -508,11 +507,6 @@ func (ta *Topological) update(ctx context.Context, vtx Vertex) error { ta.preferenceCache[vtxID] = true ta.virtuousCache[vtxID] = true return nil - case choices.Rejected: - // I'm rejected - ta.preferenceCache[vtxID] = false - ta.virtuousCache[vtxID] = false - return nil } txs, err := vtx.Txs(ctx) @@ -614,11 +608,12 @@ func (ta *Topological) update(ctx context.Context, vtx Vertex) error { // Also, this will only happen from a byzantine node issuing the vertex. // Therefore, this is very unlikely to actually be triggered in practice. - // Remove all my parents from the frontier - for _, dep := range deps { - delete(ta.frontier, dep.ID()) + if !rejectable { + for _, dep := range deps { + delete(ta.frontier, dep.ID()) + } + ta.frontier[vtxID] = vtx // I have no descendents yet } - ta.frontier[vtxID] = vtx // I have no descendents yet ta.preferenceCache[vtxID] = preferred ta.virtuousCache[vtxID] = virtuous