davidkel / hlf

0 stars 0 forks source link

[Java] When using a Connection Profile to define my network, I am unable to use discovery to determine the channel nodes #28

Open davidkel opened 4 years ago

davidkel commented 4 years ago

I have a Connection profile where I have defined a single peer and I want to use discovery to discover the channel information.

I create the NetworkConfig instance from this config and then call

Channel c = client.loadChannelFromConfig("mychannel", conf);

to create the channel configuration. However I cannot find a way to initialise this channel and use discovery. It looks like the only way I can define a peer to be used in discovery is to programmatically add the peer to the channel definition, which defeats the object of using the connection profile to bootstrap the in memory representation of the network in the application.

I thought a way round it would be to add the peer role to the connection profile as follows

"channels": {
    "mychannel": {
        "peers": {
            "peer0.org1.example.com": {
                "serviceDiscovery": true
            }
        }
    }
}

as the code looks like it might accept that as a role for a peer, however it looks like the sdk doesn't actually recognise any of the peer roles in the connection profile, see https://jira.hyperledger.org/browse/FABJ-465