Skip to content

Commit

Permalink
Remove rejected vertices from frontier during same Avalanche traversal (
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenButtolph authored Mar 25, 2023
1 parent bed13fc commit dd08351
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions snow/consensus/avalanche/topological.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit dd08351

Please sign in to comment.