为什么在hyperledger / fabric-sdk-node项目中testing/整合/ invoke.js invokeChaincode方法需要所有的对等方得到相同的结果?

在hyperledger / fabric-sdk-node项目中,使用test / integration / invoke.jstesting文件,invokeChaincode方法。 我发现当通道向所有对等点发送交易提议时,它将检查所有对等点的响应,并且只有当它们与状态码200相同时才通过发送交易。

... }).then((nothing) => { tx_id = client.newTransactionID(the_user); // send proposal to endorser var request = { chaincodeId : e2e.chaincodeId, fcn: 'move', args: ['a', 'b','100'], txId: tx_id, }; return channel.sendTransactionProposal(request); }, (err) => { t.fail('Failed to enroll user \'admin\'. ' + err); throw new Error('Failed to enroll user \'admin\'. ' + err); }).then((results) => { var proposalResponses = results[0]; var proposal = results[1]; var header = results[2]; var all_good = true; for(var i in proposalResponses) { let one_good = false; let proposal_response = proposalResponses[i]; if( proposal_response.response && proposal_response.response.status === 200) { t.pass('transaction proposal has response status of good'); one_good = channel.verifyProposalResponse(proposal_response); if(one_good) { t.pass(' transaction proposal signature and endorser are valid'); } } else { t.fail('transaction proposal was bad'); } all_good = all_good & one_good; } if (all_good) { // check all the read/write sets to see if the same, verify that each peer // got the same results on the proposal all_good = channel.compareProposalResponseResults(proposalResponses); t.pass('compareProposalResponseResults exection did not throw an error'); if(all_good){ t.pass(' All proposals have a matching read/writes sets'); } else { t.fail(' All proposals do not have matching read/write sets'); } } if (all_good) { // check to see if all the results match ... 

根据我的理解,我认为检查提案的是订货商服务的责任,而不是同行。 并不总是需要所有同行的build议是200个状态代码,这取决于代言同行的政策来决定是否可变。 例如,如果一个对等点处于closures状态,而不是一个同意对等点,那么这个scheme总是会有一个对等点发送的错误。 那么调用将永远不会成功。 我不认为这是正确的方式,这真的很奇怪。 有什么问题吗?

这个想法是为了履行(为了通过提交validation)需要来自多个组织的签名的认可策略,您需要多个对等(来自不同的组织)签署相同的有效负载。 这就是为什么要进行比较。

这就是说,这是正确的,这取决于背书政策。