diff options
author | Bojie Wu <bojie@dexon.org> | 2018-10-09 13:28:45 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-04-09 21:32:52 +0800 |
commit | d44a8b7003df87c7e7662a7ac86fb351872cd371 (patch) | |
tree | a9e30beb4e7dea57df3b6a1980514ec28eff0358 | |
parent | 470d8c119d9985e93cf54f537ccd5cc86a2fdea7 (diff) | |
download | dexon-d44a8b7003df87c7e7662a7ac86fb351872cd371.tar dexon-d44a8b7003df87c7e7662a7ac86fb351872cd371.tar.gz dexon-d44a8b7003df87c7e7662a7ac86fb351872cd371.tar.bz2 dexon-d44a8b7003df87c7e7662a7ac86fb351872cd371.tar.lz dexon-d44a8b7003df87c7e7662a7ac86fb351872cd371.tar.xz dexon-d44a8b7003df87c7e7662a7ac86fb351872cd371.tar.zst dexon-d44a8b7003df87c7e7662a7ac86fb351872cd371.zip |
app: add mutex to prevent concurrent read write map
-rw-r--r-- | dex/app.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/dex/app.go b/dex/app.go index 5193fdfb8..867c10361 100644 --- a/dex/app.go +++ b/dex/app.go @@ -496,6 +496,9 @@ func (d *DexconApp) BlockDelivered(blockHash coreCommon.Hash, result coreTypes.F // BlockConfirmed is called when a block is confirmed and added to lattice. func (d *DexconApp) BlockConfirmed(block coreTypes.Block) { + d.insertMu.Lock() + defer d.insertMu.Unlock() + d.blockchain.AddConfirmedBlock(&block) } |