@@ -19,6 +19,7 @@ package service
19
19
import (
20
20
"sync"
21
21
22
+ peerComm "github.com/hyperledger/fabric/core/comm"
22
23
"github.com/hyperledger/fabric/core/committer"
23
24
"github.com/hyperledger/fabric/gossip/comm"
24
25
gossipCommon "github.com/hyperledger/fabric/gossip/common"
@@ -29,6 +30,7 @@ import (
29
30
"github.com/hyperledger/fabric/gossip/state"
30
31
"github.com/hyperledger/fabric/protos/common"
31
32
"github.com/hyperledger/fabric/protos/utils"
33
+ "github.com/op/go-logging"
32
34
"google.golang.org/grpc"
33
35
)
34
36
@@ -55,10 +57,20 @@ type gossipServiceImpl struct {
55
57
lock sync.RWMutex
56
58
}
57
59
60
+ var logger = logging .MustGetLogger ("gossipService" )
61
+
58
62
// InitGossipService initialize gossip service
59
63
func InitGossipService (endpoint string , s * grpc.Server , bootPeers ... string ) {
60
64
once .Do (func () {
61
- gossip := integration .NewGossipComponent (endpoint , s , []grpc.DialOption {}, bootPeers ... )
65
+ logger .Info ("Initialize gossip with endpoint" , endpoint , "and bootstrap set" , bootPeers )
66
+ dialOpts := []grpc.DialOption {}
67
+ if peerComm .TLSEnabled () {
68
+ dialOpts = append (dialOpts , grpc .WithTransportCredentials (peerComm .InitTLSForPeer ()))
69
+ } else {
70
+ dialOpts = append (dialOpts , grpc .WithInsecure ())
71
+ }
72
+
73
+ gossip := integration .NewGossipComponent (endpoint , s , dialOpts , bootPeers ... )
62
74
gossipServiceInstance = & gossipServiceImpl {
63
75
gossip : gossip ,
64
76
chains : make (map [string ]state.GossipStateProvider ),
@@ -85,6 +97,7 @@ func (g *gossipServiceImpl) JoinChannel(commiter committer.Committer, block *com
85
97
return err
86
98
} else {
87
99
// Initialize new state provider for given committer
100
+ logger .Debug ("Creating state provider for chainID" , chainID )
88
101
g .chains [chainID ] = state .NewGossipStateProvider (g .gossip , commiter )
89
102
}
90
103
0 commit comments