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.

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

报告相同问题?

悬赏问题

  • ¥20 Html备忘录页面制作
  • ¥15 黄永刚的晶体塑性子程序中输入的材料参数里的晶体取向参数是什么形式的?
  • ¥20 数学建模来解决我这个问题
  • ¥15 计算机网络ip分片偏移量计算头部是-20还是-40呀
  • ¥15 stc15f2k60s2单片机关于流水灯,时钟,定时器,矩阵键盘等方面的综合问题
  • ¥15 YOLOv8已有一个初步的检测模型,想利用这个模型对新的图片进行自动标注,生成labellmg可以识别的数据,再手动修改。如何操作?
  • ¥30 NIRfast软件使用指导
  • ¥20 matlab仿真问题,求功率谱密度
  • ¥15 求micropython modbus-RTU 从机的代码或库?
  • ¥15 django5安装失败