From 947a2b720d966efae8aa8564cbe948f8eb6d5d38 Mon Sep 17 00:00:00 2001
From: Bojie Wu <bojie@dexon.org>
Date: Tue, 9 Oct 2018 13:28:45 +0800
Subject: app: add mutex to prevent concurrent read write map

---
 dex/app.go | 3 +++
 1 file changed, 3 insertions(+)

(limited to 'dex')

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)
 }
 
-- 
cgit v1.2.3