Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Submit L1 Block: fix lock bug #1558

Merged
merged 1 commit into from
Sep 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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