Skip to content

Commit

Permalink
[FABN-1254] Fix Chaincode's label for the validation
Browse files Browse the repository at this point in the history
The character restrictions for the Chaincode's package label was
merged by FAB-14597. Label must be non-empty, can only consist of
alphanumerics, '_', and '-' and can only begin with alphanumerics.
fabric-client creates a label for a Chaincode in the constructor
of the Chaincode class. The invalid character ':' is used for the
label.
This CR changes the character to '_' to satisfy the restrictions.

FABN-1254 #done

Change-Id: I2d9e57603519dee583a42c21bc881885a70973f1
Signed-off-by: Yuki Kondo <[email protected]>
  • Loading branch information
yuki-kon committed May 24, 2019
1 parent 08dbec4 commit 309dc10
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion fabric-client/lib/Chaincode.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const Chaincode = class {
this._golang_path = null;
this._package = null;
this._package_id = null;
this._label = name + ':' + version;
this._label = name + '_' + version;
this._endorsement_policy = null;
this._endorsement_policy_def = null;
this._collection_package_proto = null;
Expand Down
6 changes: 3 additions & 3 deletions fabric-client/test/Chaincode.js
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ describe('Chaincode', () => {
FakeUtils.sendPeersProposal = () => {
const payload = new lifecycle_protos.InstallChaincodeResult();
payload.setPackageId('package_id');
payload.setLabel('mychaincode:v1');
payload.setLabel('mychaincode_v1');
const response = {response: {status: 200, payload: payload.toBuffer()}};
return [response];
};
Expand All @@ -765,7 +765,7 @@ describe('Chaincode', () => {
FakeUtils.sendPeersProposal = () => {
const payload = new lifecycle_protos.InstallChaincodeResult();
payload.setPackageId('package_id');
payload.setLabel('mychaincode:fail');
payload.setLabel('mychaincode_fail');
const response = {response: {status: 200, payload: payload.toBuffer()}};
return [response];
};
Expand All @@ -788,7 +788,7 @@ describe('Chaincode', () => {
FakeUtils.sendPeersProposal = () => {
const payload = new lifecycle_protos.InstallChaincodeResult();
payload.setPackageId('package_id');
payload.setLabel('mychaincode:v1');
payload.setLabel('mychaincode_v1');
const response = {response: {status: 200, payload: payload.toBuffer()}};
return [response];
};
Expand Down

0 comments on commit 309dc10

Please sign in to comment.