Skip to content

Commit

Permalink
fix(bscc): remove hardcoded orderer in gatherOrdererInfo()
Browse files Browse the repository at this point in the history
  • Loading branch information
Tony Wu committed Aug 3, 2023
1 parent 5d27d8f commit e2b7381
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions core/scc/bscc/bscc.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,17 @@ func (bscc *BSCC) gatherOrdererInfo(channelID string) (address string, rootCertF
return "", nil, err
}

orderer, ok := ordererOrg["OrdererOrg"]
if !ok {
return "", nil, errors.New("orderer org not found")
if len(ordererOrg) == 0 {
return "", nil, errors.New("No orderer organization found")
} else {
for _, orderer := range ordererOrg {
// TODO: This is a hack, we should not assume that the orderer has only one address and one root cert.
// To be checked against multiple orderers.
return orderer.Addresses[0], orderer.RootCerts[0], nil
}
}

// TODO: This is a hack, we should not assume that the orderer has only one address and one root cert.
// To be checked against multiple orderers.
return orderer.Addresses[0], orderer.RootCerts[0], nil
return "", nil, errors.New("Error occurred gathering orderer info")
}

func (bscc *BSCC) createTempFile(rootCertFile []byte) (string, error) {
Expand Down

0 comments on commit e2b7381

Please sign in to comment.