From 067f09bb5720431986110e61b4db8f7366517221 Mon Sep 17 00:00:00 2001 From: Yoav Tock Date: Thu, 29 Oct 2020 12:23:30 +0200 Subject: [PATCH] FAB-18301 Registrar.JoinChannel takes the wrong lock type (#2058) Replace RLock() with Lock() since Registrar.JoinChannel writes to the internal data structure. Signed-off-by: Yoav Tock Change-Id: Ic78a35ad6167e4ccbb3d1613ce1085bfdcb5aba1 --- orderer/common/multichannel/registrar.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/orderer/common/multichannel/registrar.go b/orderer/common/multichannel/registrar.go index 38a16928e06..d9ce6ab1deb 100644 --- a/orderer/common/multichannel/registrar.go +++ b/orderer/common/multichannel/registrar.go @@ -693,8 +693,8 @@ func (r *Registrar) ChannelInfo(channelID string) (types.ChannelInfo, error) { // JoinChannel instructs the orderer to create a channel and join it with the provided config block. // The URL field is empty, and is to be completed by the caller. func (r *Registrar) JoinChannel(channelID string, configBlock *cb.Block, isAppChannel bool) (info types.ChannelInfo, err error) { - r.lock.RLock() - defer r.lock.RUnlock() + r.lock.Lock() + defer r.lock.Unlock() if r.systemChannelID != "" { return types.ChannelInfo{}, types.ErrSystemChannelExists