From 8096ae05fe421df32ec0188d8732543e85ba6a5d Mon Sep 17 00:00:00 2001 From: Matt <98158711+BedrockSquirrel@users.noreply.github.com> Date: Wed, 27 Sep 2023 11:06:23 +0100 Subject: [PATCH] Submit L1 Block: fix lock bug (#1558) --- go/host/enclave/guardian.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/go/host/enclave/guardian.go b/go/host/enclave/guardian.go index 6a897feaf9..3686838249 100644 --- a/go/host/enclave/guardian.go +++ b/go/host/enclave/guardian.go @@ -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