Commit e78616aa authored by Jay Guo's avatar Jay Guo
Browse files

FAB-15160 fix data race in Raft chain



Update of RaftIndex in BlockMetadata should be guarded by write
lock as well, to avoid race with clone.

Change-Id: I7656e2129eee058179f694c055f98981e91b14c5
Signed-off-by: default avatarJay Guo <guojiannan1101@gmail.com>
(cherry picked from commit fe7bd481)
parent 2feaff83
......@@ -1241,8 +1241,8 @@ func (c *Chain) writeConfigBlock(block *common.Block, index uint64) {
case common.HeaderType_CONFIG:
configMembership := c.detectConfChange(block)
c.opts.BlockMetadata.RaftIndex = index
c.raftMetadataLock.Lock()
c.opts.BlockMetadata.RaftIndex = index
if configMembership != nil {
c.opts.BlockMetadata = configMembership.NewBlockMetadata
c.opts.Consenters = configMembership.NewConsenters
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment