Skip to content
This repository has been archived by the owner on May 11, 2024. It is now read-only.

Commit

Permalink
fix(prover): fix a capacity release issue (#405)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberhorsey authored and davidtaikocha committed Sep 24, 2023
1 parent 6f0a6a1 commit 42f8ffa
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions prover/prover.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 42f8ffa

Please sign in to comment.