forked from hyperledger/fabric-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sendSignProposalを調べる #13
Comments
Channel.js /**
* Send signed transaction proposal to peer
*
* @param {SignedProposal} request signed endorse transaction proposal, this signed
* proposal would be send to peer directly.
* @param {number} timeout the timeout setting passed on sendSignedProposal
*/
async sendSignedProposal(request, timeout) {
return Channel.sendSignedProposal(request, timeout);
}
/**
* Send signed transaction proposal to peer
*
* @param {SignedProposal} request signed endorse transaction proposal, this signed
* proposal would be send to peer directly.
* @param {number} timeout the timeout setting passed on sendSignedProposal
*/
static async sendSignedProposal(request, timeout) {
const responses = await client_utils.sendPeersProposal(request.targets, request.signedProposal, timeout);
return responses;
} client-utils.js /*
* This function will return one Promise when sending a proposal to many peers
*/
module.exports.sendPeersProposal = async (peers, proposal, timeout) => {
let targets = peers;
if (!Array.isArray(peers)) {
targets = [peers];
}
// create array of promises mapping peers array to peer parameter
// settle all the promises and return array of responses
const promises = targets.map(async (peer) => {
return peer.sendProposal(proposal, timeout);
});
const responses = [];
const results = await settle(promises);
results.forEach((result) => {
if (result.isFulfilled()) {
logger.debug(`sendPeersProposal - Promise is fulfilled: ${result.value()}`);
responses.push(result.value());
} else {
logger.debug(`sendPeersProposal - Promise is rejected: ${result.reason()}`);
responses.push(result.reason());
}
});
return responses;
}; |
sendPeersProposal は、どうも fabcar の queryByChaincode でも使われているため responseが変わる意味がわかるかもしれない log挿入場所module.exports.sendPeersProposal = async (peers, proposal, timeout) => {
let targets = peers;
if (!Array.isArray(peers)) {
targets = [peers];
}
// create array of promises mapping peers array to peer parameter
// settle all the promises and return array of responses
const promises = targets.map(async (peer) => {
return peer.sendProposal(proposal, timeout);
});
const responses = [];
const results = await settle(promises);
results.forEach((result) => {
if (result.isFulfilled()) {
logger.debug(`sendPeersProposal - Promise is fulfilled: ${result.value()}`);
responses.push(result.value());
} else {
logger.debug(`sendPeersProposal - Promise is rejected: ${result.reason()}`);
responses.push(result.reason());
}
});
console.log('====sendPeersProposal==== responses', responses);
console.log('====sendPeersProposal==== responses.response', responses[0].response.payload.toString());
return responses;
}; fabcar online
fabcar offline
とおもったら、いっしょのが返ってきたっぽい? 以下場所で async sendSignedProposal(request, timeout) {
const responses = Channel.sendSignedProposal(request, timeout);
console.log('==== sendSignedProposal ===', responses);
// console.log('1====sendSignedProposal==== responses.response', responses[0].response.payload.toString());
return responses;
} |
と、色々書いたが以下のメソッドのresponseで拾えていた 😓 const proposalResponses = await channel.sendSignedProposal(sendSignedProposalReq) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No description provided.
The text was updated successfully, but these errors were encountered: