aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBojie Wu <bojie@dexon.org>2018-10-09 13:28:45 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-06-12 17:27:17 +0800
commite0c84599b660438d34972ceb494d36f83c26d430 (patch)
tree5b9e1780b6ddd883fe3bfec391d6f5db10275c66
parent1c480036940bc98702f09e2444461a349f3381cc (diff)
downloadgo-tangerine-e0c84599b660438d34972ceb494d36f83c26d430.tar
go-tangerine-e0c84599b660438d34972ceb494d36f83c26d430.tar.gz
go-tangerine-e0c84599b660438d34972ceb494d36f83c26d430.tar.bz2
go-tangerine-e0c84599b660438d34972ceb494d36f83c26d430.tar.lz
go-tangerine-e0c84599b660438d34972ceb494d36f83c26d430.tar.xz
go-tangerine-e0c84599b660438d34972ceb494d36f83c26d430.tar.zst
go-tangerine-e0c84599b660438d34972ceb494d36f83c26d430.zip
app: add mutex to prevent concurrent read write map
-rw-r--r--dex/app.go3
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)
}