Skip to content

Commit

Permalink
[FAB-5197]Check all prop-responses in balance-transfer
Browse files Browse the repository at this point in the history
"balance-transfer" app doesn't check all of the proposal responses.

An app sends a transaction proposal to multiple peers and get
multiple responses. However, the only first response
"proposalResponses[0]" is checked repeatedly in the loop.

This patch fixes the code to check all of the array value of
proposalResponses correctly.

Change-Id: Id61e691eb4d1c3a6c4a7a390584dfd74f1fc6196
Signed-off-by: Yuki Kondo <yuki.kondo@hal.hitachi.com>
  • Loading branch information
yuki-kon committed Jul 6, 2017
1 parent f9c2954 commit 70bff28
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions balance-transfer/app/install-chaincode.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ var installChaincode = function(peers, chaincodeName, chaincodePath,
var all_good = true;
for (var i in proposalResponses) {
let one_good = false;
if (proposalResponses && proposalResponses[0].response &&
proposalResponses[0].response.status === 200) {
if (proposalResponses && proposalResponses[i].response &&
proposalResponses[i].response.status === 200) {
one_good = true;
logger.info('install proposal was good');
} else {
Expand Down
4 changes: 2 additions & 2 deletions balance-transfer/app/instantiate-chaincode.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ var instantiateChaincode = function(channelName, chaincodeName, chaincodeVersion
var all_good = true;
for (var i in proposalResponses) {
let one_good = false;
if (proposalResponses && proposalResponses[0].response &&
proposalResponses[0].response.status === 200) {
if (proposalResponses && proposalResponses[i].response &&
proposalResponses[i].response.status === 200) {
one_good = true;
logger.info('instantiate proposal was good');
} else {
Expand Down
4 changes: 2 additions & 2 deletions balance-transfer/app/invoke-transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ var invokeChaincode = function(peersUrls, channelName, chaincodeName, fcn, args,
var all_good = true;
for (var i in proposalResponses) {
let one_good = false;
if (proposalResponses && proposalResponses[0].response &&
proposalResponses[0].response.status === 200) {
if (proposalResponses && proposalResponses[i].response &&
proposalResponses[i].response.status === 200) {
one_good = true;
logger.info('transaction proposal was good');
} else {
Expand Down

1 comment on commit 70bff28

@lghhh
Copy link

@lghhh lghhh commented on 70bff28 Aug 15, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a bug at install-chaincode.js
var tx_id = null; is missing.

Please sign in to comment.