Skip to content

Anchor peer update uses hardcoded peer0 prefix, ignores custom peer prefix config #751

@Slambot01

Description

@Slambot01

Summary

notifyOrgAboutNewChannel and notifyOrgAboutNewChannelTls in commands-generated.sh are hardcoding peer0.<org.domain> as the peer address instead of using the peer.prefix from the config. Everything else in the same file handles the prefix correctly, so this one just got missed.

You can see it clearly if you run:

  1. Set up a config with "peer": { "instances": 2, "prefix": "node" }
  2. Run fablo generate fablo-config.json
  3. Check: grep "notifyOrgAboutNewChannel" fablo-target/fabric-docker/commands-generated.sh

All other operations will show node0.org1.example.com but notifyOrgAboutNewChannel is still pointing at peer0.org1.example.com.

Root Cause

Lines 219 and 226 in src/setup-docker/templates/fabric-docker/commands-generated.sh have the peer address hardcoded:

"peer0.<%= org.domain %>"

It should be org.headPeer.address which is already prefix-aware. org.headPeer is computed from the peer list in extendOrgsConfig.ts:258 (headPeer: peers[0]) and the exact same pattern is already being used correctly in chaincode-install-v2.sh (lines 33, 66, 89, 90) and chaincode-dev-v2.sh (lines 11, 26, 34).

Impact

Any network with a custom peer prefix will fail at anchor peer update. The CLI looks for peer0.org1.example.com which doesn't exist as a container, Docker DNS resolution fails, and the error gives no hint that the prefix config is being ignored. Took a while to track down.

Suggested Fix

Two lines need updating in src/setup-docker/templates/fabric-docker/commands-generated.sh:

-         "peer0.<%= org.domain %>" <% -%>
+         "<%= org.headPeer.address %>" <% -%>

Line 219 is the non-TLS case, line 226 is the TLS variant.

Opened PR for this fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions