mirror of
https://github.com/QuilibriumNetwork/ceremonyclient.git
synced 2026-03-10 18:57:32 +08:00
fix: preempt prover from planning with no workers
This commit is contained in:
parent
006ef46731
commit
036d94a4fa
@ -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,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user