dongwei9771 2019-07-18 08:48
浏览 409
已采纳

Fabric GO SDK的背书政策问题

I have a hyperledger fabric testnet with 2 orgs, 3 peers in org1 and 2 peers in org2. The peer0 of each organization is the anchor peer. I want to instantiate a chaincode with an endorsment policy with only one organization: Org1, so I specify the policy: "AND('org1MSP.member')".

I've installed the chaincode in the peers of the org1 only, because org2 is not endorser. However, the chaincode doesn't instantiate because it sending the proposal to the peers that are in the other organization (org2).

The problem is because these peers in the org2 don't have the chaincode installed, but...why the SDK is sending the endorsement request to the peers that not belongs to the endorsement policy?

Here's is my config file, as you can see I only have one peer of the org1: https://gist.github.com/mtnieto/02dd17097de64a73bd627594056598ed

I have add to the config the following features, but it's not working.

channels:

  # multi-org test channel
  examplechannel:

    peers:
      peer0.org1.example.com:
        endorsingPeer: true
        chaincodeQuery: true
        ledgerQuery: true
        eventSource: true
      peer1.org1.example.com:
        endorsingPeer: false
        chaincodeQuery: false
        ledgerQuery: true
        eventSource: true


      peer2.org1.example.com:
        endorsingPeer: false
        chaincodeQuery: false
        ledgerQuery: true
        eventSource: true

      peer0.org2.example.com:
        endorsingPeer: false
        chaincodeQuery: false
        ledgerQuery: true
        eventSource: true

      peer1.org2.example.com:
        endorsingPeer: false
        chaincodeQuery: false
        ledgerQuery: true
        eventSource: true

The logs are the following:

"error": "Error creating Chaincode: sending deploy transaction proposal failed: Multiple errors occurred: - Transaction processing for endorser [peer0.org2.example.com:8051]: Endorser Client Status Code: (23) CHAINCODE_NAME_NOT_FOUND. Description: cannot get package for chaincode (examplecc:2) - Transaction processing for endorser [peer1.org2.example.com:6051]: Endorser Client Status Code: (23) CHAINCODE_NAME_NOT_FOUND. Description: cannot get package for chaincode (examplecc:2)"

The code to instantiate the chaincode is the following. (In a previously phase I have already installed the chaincode)

sdk, err = fabsdk.New(config.FromFile("config.yaml"))
    if err != nil {
        log.Errorf("Failed to create new SDK: ", err)
        return nil, err
    }

adminContext := sdk.Context("admin", "org1"))
// Org resource management client
orgResMgmt, err := resmgmt.New(adminContext)
if err != nil {
    log.Errorf("Failed to create resource management client %v: ", err)
    return nil, err

}


ccPolicy, err := cauthdsl.FromString(instantiateReq.EndorsmentPolicy)
if err != nil {
    log.Errorf(" Error parsing endorsment policy %v: ", err)
    return "", err
}   

instantiateRequest := resmgmt.InstantiateCCRequest{Name: instantiateReq.Name, Path: instantiateReq.Path, Version: instantiateReq.Version, Args: instantiateReq.Args, Policy: ccPolicy}

This happens when the peer is updated to be anchor. In other words, If I don't execute the following commands in the peers when I init the network, the error is not happening.

(in peer0 org1 context)

peer channel update -o orderer0.example.com:7050 -c $CHANNEL_NAME --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA -f ./channel-artifacts/org1MSPanchors.tx >&log.txt

in peer0 org2 context

peer channel update -o orderer0.example.com:7050 -c $CHANNEL_NAME --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA -f ./channel-artifacts/org2MSPanchors.tx >&log.txt
  • 写回答

1条回答 默认 最新

  • doudeng2025 2019-07-26 10:45
    关注

    It's a bug in the 1.4.1 version, the not endorser organization is trying to execute lscc and to endorse the transaction.

    I have upgrade the network to 1.4.2 and now it seems that the issue has disappeared.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同
  • ¥50 如何openEuler 22.03上安装配置drbd
  • ¥20 ING91680C BLE5.3 芯片怎么实现串口收发数据
  • ¥15 无线连接树莓派,无法执行update,如何解决?(相关搜索:软件下载)
  • ¥15 Windows11, backspace, enter, space键失灵