From 42f8ffa1de5b9920d3cc07a04568ed0b339191fc Mon Sep 17 00:00:00 2001 From: jeff <113397187+cyberhorsey@users.noreply.github.com> Date: Sun, 24 Sep 2023 00:58:39 -0700 Subject: [PATCH] fix(prover): fix a capacity release issue (#405) --- prover/prover.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/prover/prover.go b/prover/prover.go index f55e72514..7447a2269 100644 --- a/prover/prover.go +++ b/prover/prover.go @@ -642,20 +642,21 @@ func (p *Prover) onBlockProposed( // submitProofOp performs a proof submission operation. func (p *Prover) submitProofOp(ctx context.Context, proofWithHeader *proofProducer.ProofWithHeader) { p.submitProofConcurrencyGuard <- struct{}{} + go func() { + p.currentBlocksBeingProvenMutex.Lock() + delete(p.currentBlocksBeingProven, proofWithHeader.Meta.Id) + p.currentBlocksBeingProvenMutex.Unlock() + defer func() { <-p.submitProofConcurrencyGuard - p.currentBlocksBeingProvenMutex.Lock() - delete(p.currentBlocksBeingProven, proofWithHeader.Meta.Id) - p.currentBlocksBeingProvenMutex.Unlock() + if !p.cfg.OracleProver { + p.capacityManager.ReleaseOneCapacity() + } }() if err := backoff.Retry( func() error { - if !p.cfg.OracleProver { - p.capacityManager.ReleaseOneCapacity() - } - err := p.validProofSubmitter.SubmitProof(p.ctx, proofWithHeader) if err != nil { log.Error("Submit proof error", "error", err)