From 036d94a4fac630b2bcb5af999f03d374bb4d9962 Mon Sep 17 00:00:00 2001 From: Cassandra Heart Date: Tue, 7 Oct 2025 00:14:35 -0500 Subject: [PATCH] fix: preempt prover from planning with no workers --- node/consensus/global/event_distributor.go | 25 +++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/node/consensus/global/event_distributor.go b/node/consensus/global/event_distributor.go index 9200a42..1a6a81d 100644 --- a/node/consensus/global/event_distributor.go +++ b/node/consensus/global/event_distributor.go @@ -1,6 +1,7 @@ package global import ( + "bytes" "encoding/hex" "fmt" "math/rand" @@ -81,7 +82,18 @@ func (e *GlobalConsensusEngine) eventDistributorLoop() { e.publishKeyRegistry() } if e.proposer != nil { - e.evaluateForProposals(data) + workers, err := e.workerManager.RangeWorkers() + if err != nil { + e.logger.Error("could not retrieve workers", zap.Error(err)) + } else { + allocated := true + for _, w := range workers { + allocated = allocated && w.Allocated + } + if !allocated { + e.evaluateForProposals(data) + } + } } } @@ -402,6 +414,17 @@ func (e *GlobalConsensusEngine) evaluateForProposals( continue } + allocated := false + for _, prover := range info { + if bytes.Equal(prover.Address, e.getProverAddress()) { + allocated = true + } + } + + if allocated { + continue + } + size := e.hypergraph.GetSize(&key, path) resp, err := e.hypergraph.GetChildrenForPath( e.ctx,