Skip to content

Commit

Permalink
Parse the chaincode name from the label to compare
Browse files Browse the repository at this point in the history
Signed-off-by: Jim Zhang <[email protected]>
  • Loading branch information
jimthematrix committed Aug 17, 2023
1 parent 6af2686 commit 13d6d3c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/blockchain/fabric/fabric_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"os"
"path"
"path/filepath"
"regexp"

"github.com/hyperledger/firefly-cli/internal/blockchain/fabric/fabconnect"
"github.com/hyperledger/firefly-cli/internal/docker"
Expand Down Expand Up @@ -543,7 +544,9 @@ func (p *FabricProvider) DeployContract(filename, contractName, instanceName str
chaincodeInstalled := false
packageID := ""
for _, installedChaincode := range res.InstalledChaincodes {
if installedChaincode.Label == chaincode {
validLabel := regexp.MustCompile(`^([^_]+)_.+$`)
matches := validLabel.FindStringSubmatch(installedChaincode.Label)
if len(matches) > 0 && matches[1] == chaincode {
chaincodeInstalled = true
packageID = installedChaincode.PackageID
break
Expand Down

0 comments on commit 13d6d3c

Please sign in to comment.