Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Fabric channel init #751

Merged
merged 1 commit into from
Mar 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions packages/caliper-fabric/lib/adaptor-versions/v1/fabric-v1.js
Original file line number Diff line number Diff line change
Expand Up @@ -709,12 +709,21 @@ class Fabric extends BlockchainInterface {
* Initializes the given channel of every client profile to be able to verify proposal responses.
* @param {Map<string, FabricClient>} profiles The collection of client profiles.
* @param {string} channel The name of the channel to initialize.
* @param {boolean} admin Indicates whether the profiles are admin profiles.
* @private
* @async
*/
async _initializeChannel(profiles, channel) {
async _initializeChannel(profiles, channel, admin) {
// initialize the channel for every client profile from the local config
for (let profile of profiles.entries()) {
let profileOrg = admin ? profile[0] : this.networkUtil.getOrganizationOfClient(profile[0]);
let channelOrgs = this.networkUtil.getOrganizationsOfChannel(channel);

// skip init for profiles whose org is a not a member of the channel
if (!channelOrgs.has(profileOrg)) {
continue;
}

let ch = profile[1].getChannel(channel, false);
if (ch) {
try {
Expand Down Expand Up @@ -1959,8 +1968,8 @@ class Fabric extends BlockchainInterface {
// Configure the adaptor
for (let channel of this.networkUtil.getChannels()) {
// initialize the channels by getting the config from the orderer
await this._initializeChannel(this.adminProfiles, channel);
await this._initializeChannel(this.clientProfiles, channel);
await this._initializeChannel(this.adminProfiles, channel, true);
await this._initializeChannel(this.clientProfiles, channel, false);
}

if (this.networkUtil.isInCompatibilityMode()) {
Expand Down
15 changes: 12 additions & 3 deletions packages/caliper-fabric/lib/adaptor-versions/v2/fabric-v2.js
Original file line number Diff line number Diff line change
Expand Up @@ -710,12 +710,21 @@ class Fabric extends BlockchainInterface {
* Initializes the given channel of every client profile to be able to verify proposal responses.
* @param {Map<string, FabricClient>} profiles The collection of client profiles.
* @param {string} channel The name of the channel to initialize.
* @param {boolean} admin Indicates whether the profiles are admin profiles.
* @private
* @async
*/
async _initializeChannel(profiles, channel) {
async _initializeChannel(profiles, channel, admin) {
// initialize the channel for every client profile from the local config
for (let profile of profiles.entries()) {
let profileOrg = admin ? profile[0] : this.networkUtil.getOrganizationOfClient(profile[0]);
let channelOrgs = this.networkUtil.getOrganizationsOfChannel(channel);

// skip init for profiles whose org is a not a member of the channel
if (!channelOrgs.has(profileOrg)) {
continue;
}

let ch = profile[1].getChannel(channel, false);
if (ch) {
try {
Expand Down Expand Up @@ -1959,8 +1968,8 @@ class Fabric extends BlockchainInterface {
// Configure the adaptor
for (let channel of this.networkUtil.getChannels()) {
// initialize the channels by getting the config from the orderer
await this._initializeChannel(this.adminProfiles, channel);
await this._initializeChannel(this.clientProfiles, channel);
await this._initializeChannel(this.adminProfiles, channel, true);
await this._initializeChannel(this.clientProfiles, channel, false);
}

if (this.networkUtil.isInCompatibilityMode()) {
Expand Down