diff options
author | Bojie Wu <bojie@dexon.org> | 2018-11-01 17:53:06 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@byzantine-lab.io> | 2019-06-12 17:27:17 +0800 |
commit | 7cd4ecd047ee297e10753ff642ad4893418ace48 (patch) | |
tree | 1b421f392a5505248770486509059dec7a16a7a5 | |
parent | ec9a70730d3effe5a3d942fbd07d6414ce8dc07f (diff) | |
download | go-tangerine-7cd4ecd047ee297e10753ff642ad4893418ace48.tar go-tangerine-7cd4ecd047ee297e10753ff642ad4893418ace48.tar.gz go-tangerine-7cd4ecd047ee297e10753ff642ad4893418ace48.tar.bz2 go-tangerine-7cd4ecd047ee297e10753ff642ad4893418ace48.tar.lz go-tangerine-7cd4ecd047ee297e10753ff642ad4893418ace48.tar.xz go-tangerine-7cd4ecd047ee297e10753ff642ad4893418ace48.tar.zst go-tangerine-7cd4ecd047ee297e10753ff642ad4893418ace48.zip |
app: add lock to prevent concurrent map read write
-rw-r--r-- | core/blockchain.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/core/blockchain.go b/core/blockchain.go index 264617857..1a60805a1 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -290,6 +290,9 @@ func (bc *BlockChain) AddConfirmedBlock(block *coreTypes.Block) error { } func (bc *BlockChain) RemoveConfirmedBlock(hash coreCommon.Hash) { + bc.confirmedBlocksMu.Lock() + defer bc.confirmedBlocksMu.Unlock() + blockInfo := bc.confirmedBlocks[hash] for addr := range blockInfo.addresses { bc.addressCounter[addr]-- |