Skip to content

Commit

Permalink
Submit L1 Block: fix lock bug (#1558)
Browse files Browse the repository at this point in the history
  • Loading branch information
BedrockSquirrel authored Sep 27, 2023
1 parent 235d0a9 commit 8096ae0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion go/host/enclave/guardian.go
Original file line number Diff line number Diff line change
Expand Up @@ -391,10 +391,11 @@ func (g *Guardian) submitL1Block(block *common.L1Block, isLatest bool) (bool, er
}
receipts, err := g.sl.L1Repo().FetchObscuroReceipts(block)
if err != nil {
g.submitDataLock.Unlock() // lock must be released before returning
return false, fmt.Errorf("could not fetch obscuro receipts for block=%s - %w", block.Hash(), err)
}
resp, err := g.enclaveClient.SubmitL1Block(*block, receipts, isLatest)
g.submitDataLock.Unlock()
g.submitDataLock.Unlock() // lock is only guarding the enclave call, so we can release it now
if err != nil {
if strings.Contains(err.Error(), errutil.ErrBlockAlreadyProcessed.Error()) {
// we have already processed this block, let's try the next canonical block
Expand Down

0 comments on commit 8096ae0

Please sign in to comment.