Skip to content

Commit

Permalink
FABN-1413 NodeSDK addCommitter fails
Browse files Browse the repository at this point in the history
The addCommitter and addEndorser now check that the
service endpoint is connected before allowing them to
be assigned to this channel. This makes the endpoints
available for service request.

Signed-off-by: Bret Harrison <[email protected]>
Change-Id: I51f1aa1bb4be1d5d5f4605f63702e14aff32699e
  • Loading branch information
harrisob committed Nov 6, 2019
1 parent 9a38da6 commit eeebb17
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions fabric-common/lib/DiscoveryService.js
Original file line number Diff line number Diff line change
Expand Up @@ -580,10 +580,10 @@ class DiscoveryService extends ServiceAction {
const url = this._buildUrl(host, port);
logger.debug(`${method} - create a new orderer ${url}`);
const orderer = this.client.newCommitter(address, msp_id);
this.channel.addCommitter(orderer);
const end_point = this.client.newEndpoint(this._buildOptions(address, url, host, msp_id));
try {
await orderer.connect(end_point);
this.channel.addCommitter(orderer);
} catch (error) {
logger.error(`${method} - Unable to connect to the discovered orderer ${address} due to ${error}`);
}
Expand Down Expand Up @@ -611,11 +611,11 @@ class DiscoveryService extends ServiceAction {
const url = this._buildUrl(host_port[0], host_port[1]);
logger.debug(`${method} - create a new endorser ${url}`);
const peer = this.client.getEndorser(address, msp_id);
this.channel.addEndorser(peer);
const end_point = this.client.newEndpoint(this._buildOptions(address, url, host_port[0], msp_id));
try {
logger.debug(`${method} - about to connect to endorser ${address} url:${url}`);
await peer.connect(end_point);
this.channel.addEndorser(peer);
logger.debug(`${method} - connected to peer ${address} url:${url}`);
} catch (error) {
logger.error(`${method} - Unable to connect to the discovered peer ${address} due to ${error}`);
Expand Down
2 changes: 1 addition & 1 deletion test/scenario/features/steps/base_steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ module.exports = function () {
}

// check the orderers discovered for mspid
orderers = channel.getOrderers('OrdererMSP'); // gets all peers
orderers = channel.getCommitters('OrdererMSP'); // gets all peers
if (await orderers[0].checkConnection()) {
testUtil.logMsg(`Orderer ${orderers[0].name} is connected`);
} else {
Expand Down

0 comments on commit eeebb17

Please sign in to comment.