Skip to content

fix: use headPeer.address in anchor peer update instead of hardcoded peer0#756

Open
Slambot01 wants to merge 2 commits into
hyperledger-labs:mainfrom
Slambot01:fix/anchor-peer-hardcoded-prefix
Open

fix: use headPeer.address in anchor peer update instead of hardcoded peer0#756
Slambot01 wants to merge 2 commits into
hyperledger-labs:mainfrom
Slambot01:fix/anchor-peer-hardcoded-prefix

Conversation

@Slambot01
Copy link
Copy Markdown
Contributor

@Slambot01 Slambot01 commented May 13, 2026

Summary

notifyOrgAboutNewChannel and notifyOrgAboutNewChannelTls in commands-generated.sh were hardcoding peer0.<org.domain> as the peer address instead of respecting the peer.prefix config field. If you set a custom prefix like "prefix": "node", everything else in the generated file picks it up and uses node0.org1.example.com, but the anchor peer update was still pointing at peer0.org1.example.com which doesn't exist as a container. Docker DNS silently fails with no obvious indication that the prefix config is being ignored.

Fix

Switched to org.headPeer.address which already handles the prefix correctly. headPeer is just peers[0] from the prefix-aware peer list built in extendOrgsConfig.ts:258, and the same pattern is already used in chaincode-install-v2.sh and chaincode-dev-v2.sh. All 17 unit tests pass.

Fixes #751

…peer0

Fixes hyperledger-labs#751

Signed-off-by: Ritesh Pandit <riteshpandit1708@gmail.com>
@Slambot01 Slambot01 force-pushed the fix/anchor-peer-hardcoded-prefix branch from 3a132ed to cb0e2c5 Compare May 13, 2026 06:17
Fixes hyperledger-labs#751

Signed-off-by: Ritesh Pandit <riteshpandit1708@gmail.com>
@Slambot01
Copy link
Copy Markdown
Contributor Author

test-02-raft failure is unrelated to this PR and was already present before these changes. The CI logs show the failure happens during Java chaincode (chaincode2) installation, where build.sh crashes with "cd: null directory" even though the Gradle build completes successfully. This points to a fragile issue in the sample chaincode build script itself.The anchor peer fix in this PR only changes updateAnchorPeers inside commands-generated.sh. The channel creation logs also confirm the fix is working correctly, as my-channel2 is successfully created and joined by Org1/peer1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant