From 97069a05d5688b2d21b7d3799bacd5f048e9d5cb Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Wed, 18 Nov 2020 18:27:06 +0300 Subject: [PATCH] core: fix locking in storeBlock --- pkg/core/blockchain.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/core/blockchain.go b/pkg/core/blockchain.go index bfe44143b..d0c0a4007 100644 --- a/pkg/core/blockchain.go +++ b/pkg/core/blockchain.go @@ -705,9 +705,11 @@ func (bc *Blockchain) storeBlock(block *block.Block, txpool *mempool.Pool) error return err } if err := bc.contracts.Policy.OnPersistEnd(bc.dao); err != nil { + bc.lock.Unlock() return fmt.Errorf("failed to call OnPersistEnd for Policy native contract: %w", err) } if err := bc.contracts.Designate.OnPersistEnd(bc.dao); err != nil { + bc.lock.Unlock() return err } bc.dao.MPT.Flush()