peer endorsement policy not working hyperledger fa

2019-08-27 19:22发布

问题:

I am trying to enforce simple endorsement policy for 2 org network. Here is my crypto-config.yaml

OrdererOrgs:
  - Name: Orderer
    Domain: example.com
    Specs:
      - Hostname: orderer
PeerOrgs:
  - Name: Org1
    Domain: org1.example.com
    EnableNodeOUs: true
    # CA:
    #   OrganizationalUnit: peer
    Template:
      Count: 1
    Users:
      Count: 1
  - Name: Org2
    Domain: org2.example.com
    EnableNodeOUs: true
    # CA:
    #   OrganizationalUnit: peer
    Template:
      Count: 1
    Users:
      Count: 1

And i can see OU as peer in both peers.

peer0.org2.example.com  
Identity: peer0.org2.example.com  
Verified by: ca.org2.example.com  
Expires: Saturday 23 December 2028 

Subject Name

C (Country):    US  
ST (State): California  
L (Locality):   San Francisco  
OU (Organizational Unit):   peer  
CN (Common Name):   peer0.org2.example.com 

endorsement policy for member check works

peer chaincode instantiate -o orderer.example.com:7050 -C mychannel -n chaincode -l node -v v0 -c '{"args":["init"]}' -P "AND('Org1MSP.member', 'Org2MSP.member')"  

but endorsement policy for peer check not working

peer chaincode instantiate -o orderer.example.com:7050 -C mychannel -n chaincode -l node -v v0 -c '{"args":["init"]}' -P "AND('Org1MSP.peer', 'Org2MSP.peer')"  

When i invoke any function.

Transaction failed to be committed to the ledger due to ::ENDORSEMENT_POLICY_FAILURE

even "OR('Org1MSP.peer', 'Org2MSP.peer')" not working