Exemplo n.º 1
0
def step_impl(context, userName, certAlias, proposalAlias, channelName,
              ccSpecAlias):
    directory = bootstrap_util.getDirectory(context=context)
    user = directory.getUser(userName=userName)
    assert ccSpecAlias in user.tags, "ChaincodeSpec alias '{0}' not found for user '{1}'".format(
        ccSpecAlias, userName)
    ccSpec = user.tags[ccSpecAlias]

    ccDeploymentSpec = endorser_util.createDeploymentSpec(context=context,
                                                          ccSpec=ccSpec)
    ccDeploymentSpec.code_package = ""
    lcChaincodeSpec = endorser_util.createDeploymentChaincodeSpecForBDD(
        ccDeploymentSpec=ccDeploymentSpec, chainID=str(channelName))
    # Find the cert using the cert tuple information saved for the user under certAlias
    nodeAdminTuple = user.tags[certAlias]
    signersCert = directory.findCertForNodeAdminTuple(nodeAdminTuple)
    mspID = nodeAdminTuple.organization

    proposal = endorser_util.createInvokeProposalForBDD(
        context,
        ccSpec=lcChaincodeSpec,
        chainID=channelName,
        signersCert=signersCert,
        Mspid=mspID,
        type="ENDORSER_TRANSACTION")

    signedProposal = endorser_util.signProposal(proposal=proposal,
                                                entity=user,
                                                signersCert=signersCert)

    # proposal = endorser_util.createDeploymentProposalForBDD(ccDeploymentSpec)
    assert not proposalAlias in user.tags, "Proposal alias '{0}' already exists for '{1}'".format(
        proposalAlias, userName)
    user.setTagValue(proposalAlias, signedProposal)
Exemplo n.º 2
0
def step_impl(context, userName, certAlias, proposalAlias, channelName, ccSpecAlias):
        directory = bootstrap_util.getDirectory(context=context)
        user = directory.getUser(userName=userName)
        assert ccSpecAlias in user.tags, "ChaincodeSpec alias '{0}' not found for user '{1}'".format(ccSpecAlias, userName)
        ccSpec = user.tags[ccSpecAlias]


        ccDeploymentSpec = endorser_util.createDeploymentSpec(context=context, ccSpec=ccSpec)
        lcChaincodeSpec = endorser_util.createDeploymentChaincodeSpecForBDD(ccDeploymentSpec=ccDeploymentSpec, chainID=str(channelName))
        # Find the cert using the cert tuple information saved for the user under certAlias
        nodeAdminTuple = user.tags[certAlias]
        signersCert = directory.findCertForNodeAdminTuple(nodeAdminTuple)
        mspID = nodeAdminTuple.organization

        proposal = endorser_util.createInvokeProposalForBDD(ccSpec=lcChaincodeSpec, chainID=channelName,signersCert=signersCert, Mspid=mspID, type="ENDORSER_TRANSACTION")

        signedProposal = endorser_util.signProposal(proposal=proposal, entity=user, signersCert=signersCert)

        # proposal = endorser_util.createDeploymentProposalForBDD(ccDeploymentSpec)
        assert not proposalAlias in user.tags, "Proposal alias '{0}' already exists for '{1}'".format(proposalAlias, userName)
        user.tags[proposalAlias] = signedProposal