@@ -25,6 +25,7 @@ import (
25
25
26
26
"github.com/hyperledger/fabric/core/comm"
27
27
"github.com/hyperledger/fabric/core/deliverservice/blocksprovider"
28
+ "github.com/hyperledger/fabric/gossip/api"
28
29
"github.com/hyperledger/fabric/protos/orderer"
29
30
"github.com/op/go-logging"
30
31
"golang.org/x/net/context"
@@ -95,13 +96,15 @@ type deliverServiceImpl struct {
95
96
stopping bool
96
97
97
98
conn * grpc.ClientConn
99
+
100
+ mcs api.MessageCryptoService
98
101
}
99
102
100
103
// NewDeliverService construction function to create and initialize
101
104
// delivery service instance. It tries to establish connection to
102
105
// the specified in the configuration ordering service, in case it
103
106
// fails to dial to it, return nil
104
- func NewDeliverService (gossip blocksprovider.GossipServiceAdapter , endpoints []string ) (DeliverService , error ) {
107
+ func NewDeliverService (gossip blocksprovider.GossipServiceAdapter , endpoints []string , mcs api. MessageCryptoService ) (DeliverService , error ) {
105
108
indices := rand .Perm (len (endpoints ))
106
109
for _ , idx := range indices {
107
110
logger .Infof ("Creating delivery service to get blocks from the ordering service, %s" , endpoints [idx ])
@@ -119,20 +122,21 @@ func NewDeliverService(gossip blocksprovider.GossipServiceAdapter, endpoints []s
119
122
logger .Errorf ("Cannot dial to %s, because of %s" , endpoints [idx ], err )
120
123
continue
121
124
}
122
- return NewFactoryDeliverService (gossip , & blocksDelivererFactoryImpl {conn }, conn ), nil
125
+ return NewFactoryDeliverService (gossip , & blocksDelivererFactoryImpl {conn }, conn , mcs ), nil
123
126
}
124
127
return nil , fmt .Errorf ("Wasn't able to connect to any of ordering service endpoints %s" , endpoints )
125
128
}
126
129
127
130
// NewFactoryDeliverService construction function to create and initialize
128
131
// delivery service instance, with gossip service adapter and customized
129
132
// factory to create blocks deliverers.
130
- func NewFactoryDeliverService (gossip blocksprovider.GossipServiceAdapter , factory BlocksDelivererFactory , conn * grpc.ClientConn ) DeliverService {
133
+ func NewFactoryDeliverService (gossip blocksprovider.GossipServiceAdapter , factory BlocksDelivererFactory , conn * grpc.ClientConn , mcs api. MessageCryptoService ) DeliverService {
131
134
return & deliverServiceImpl {
132
135
clientsFactory : factory ,
133
136
gossip : gossip ,
134
137
clients : make (map [string ]blocksprovider.BlocksProvider ),
135
138
conn : conn ,
139
+ mcs : mcs ,
136
140
}
137
141
}
138
142
@@ -159,7 +163,7 @@ func (d *deliverServiceImpl) StartDeliverForChannel(chainID string, ledgerInfo b
159
163
return err
160
164
}
161
165
logger .Debug ("This peer will pass blocks from orderer service to other peers" )
162
- d .clients [chainID ] = blocksprovider .NewBlocksProvider (chainID , abc , d .gossip )
166
+ d .clients [chainID ] = blocksprovider .NewBlocksProvider (chainID , abc , d .gossip , d . mcs )
163
167
164
168
if err := d .clients [chainID ].RequestBlocks (ledgerInfo ); err == nil {
165
169
// Start reading blocks from ordering service in case this peer is a leader for specified chain
0 commit comments