Merge branch 'master' of github.com:ava-labs/gecko

This commit is contained in:
StephenButtolph 2020-06-16 23:08:17 -04:00
commit 181bd76b10
1 changed files with 5 additions and 5 deletions

View File

@ -335,10 +335,10 @@ func (t *Transitive) reinsertFrom(vdr ids.ShortID, vtxID ids.ID) (bool, error) {
func (t *Transitive) insertFrom(vdr ids.ShortID, vtx avalanche.Vertex) (bool, error) { func (t *Transitive) insertFrom(vdr ids.ShortID, vtx avalanche.Vertex) (bool, error) {
issued := true issued := true
vts := []avalanche.Vertex{vtx} vertexHeap := newMaxVertexHeap()
for len(vts) > 0 { vertexHeap.Push(vtx)
vtx := vts[0] for vertexHeap.Len() > 0 {
vts = vts[1:] vtx := vertexHeap.Pop()
if t.Consensus.VertexIssued(vtx) { if t.Consensus.VertexIssued(vtx) {
continue continue
@ -353,7 +353,7 @@ func (t *Transitive) insertFrom(vdr ids.ShortID, vtx avalanche.Vertex) (bool, er
t.sendRequest(vdr, parent.ID()) t.sendRequest(vdr, parent.ID())
issued = false issued = false
} else { } else {
vts = append(vts, parent) vertexHeap.Push(parent)
} }
} }