@@ -29,7 +29,6 @@ import (
29
29
"github.com/hyperledger/fabric/gossip/integration"
30
30
"github.com/hyperledger/fabric/gossip/state"
31
31
"github.com/hyperledger/fabric/gossip/util"
32
- "github.com/hyperledger/fabric/peer/gossip/mcs"
33
32
"github.com/hyperledger/fabric/peer/gossip/sa"
34
33
"github.com/hyperledger/fabric/protos/common"
35
34
proto "github.com/hyperledger/fabric/protos/gossip"
@@ -99,13 +98,13 @@ func (jcm *joinChannelMessage) AnchorPeers() []api.AnchorPeer {
99
98
var logger = util .GetLogger (util .LoggingServiceModule , "" )
100
99
101
100
// InitGossipService initialize gossip service
102
- func InitGossipService (peerIdentity []byte , endpoint string , s * grpc.Server , bootPeers ... string ) {
103
- InitGossipServiceCustomDeliveryFactory (peerIdentity , endpoint , s , & deliveryFactoryImpl {}, bootPeers ... )
101
+ func InitGossipService (peerIdentity []byte , endpoint string , s * grpc.Server , mcs api. MessageCryptoService , bootPeers ... string ) {
102
+ InitGossipServiceCustomDeliveryFactory (peerIdentity , endpoint , s , & deliveryFactoryImpl {}, mcs , bootPeers ... )
104
103
}
105
104
106
105
// InitGossipService initialize gossip service with customize delivery factory
107
106
// implementation, might be useful for testing and mocking purposes
108
- func InitGossipServiceCustomDeliveryFactory (peerIdentity []byte , endpoint string , s * grpc.Server , factory DeliveryServiceFactory , bootPeers ... string ) {
107
+ func InitGossipServiceCustomDeliveryFactory (peerIdentity []byte , endpoint string , s * grpc.Server , factory DeliveryServiceFactory , mcs api. MessageCryptoService , bootPeers ... string ) {
109
108
once .Do (func () {
110
109
logger .Info ("Initialize gossip with endpoint" , endpoint , "and bootstrap set" , bootPeers )
111
110
dialOpts := []grpc.DialOption {}
@@ -115,7 +114,6 @@ func InitGossipServiceCustomDeliveryFactory(peerIdentity []byte, endpoint string
115
114
dialOpts = append (dialOpts , grpc .WithInsecure ())
116
115
}
117
116
118
- cryptSvc := mcs .NewMessageCryptoService ()
119
117
secAdv := sa .NewSecurityAdvisor ()
120
118
121
119
if overrideEndpoint := viper .GetString ("peer.gossip.endpoint" ); overrideEndpoint != "" {
@@ -124,14 +122,14 @@ func InitGossipServiceCustomDeliveryFactory(peerIdentity []byte, endpoint string
124
122
125
123
if viper .GetBool ("peer.gossip.ignoreSecurity" ) {
126
124
sec := & secImpl {[]byte (endpoint )}
127
- cryptSvc = sec
125
+ mcs = sec
128
126
secAdv = sec
129
127
peerIdentity = []byte (endpoint )
130
128
}
131
129
132
- idMapper := identity .NewIdentityMapper (cryptSvc )
130
+ idMapper := identity .NewIdentityMapper (mcs )
133
131
134
- gossip := integration .NewGossipComponent (peerIdentity , endpoint , s , secAdv , cryptSvc , idMapper , dialOpts , bootPeers ... )
132
+ gossip := integration .NewGossipComponent (peerIdentity , endpoint , s , secAdv , mcs , idMapper , dialOpts , bootPeers ... )
135
133
gossipServiceInstance = & gossipServiceImpl {
136
134
gossipSvc : gossip ,
137
135
chains : make (map [string ]state.GossipStateProvider ),
0 commit comments