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 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog