Skip to content

Commit

Permalink
[FAB-5913]balance-transfer:Fix query response message
Browse files Browse the repository at this point in the history
"queryChaincode" doesn’t output responses from all
peers in log message. It exits the loop processing after
outputting the first response.
We should print all responses from all peers. Also, we should
return a response (e.g. the response_payloads[0]) after the loop.

This patch fixes the problems above.

Change-Id: I92a0c5a663d6da0854d89bf76c5ba36da86754ef
Signed-off-by: Yuki Kondo <yuki.kondo@hal.hitachi.com>
  • Loading branch information
yuki-kon committed Nov 10, 2017
1 parent ff5d80b commit 948e237
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions balance-transfer/app/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ var queryChaincode = async function(peer, channelName, chaincodeName, args, fcn,
for (let i = 0; i < response_payloads.length; i++) {
logger.info(args[0]+' now has ' + response_payloads[i].toString('utf8') +
' after the move');
return args[0]+' now has ' + response_payloads[i].toString('utf8') +
' after the move';
}
return args[0]+' now has ' + response_payloads[0].toString('utf8') +
' after the move';
} else {
logger.error('response_payloads is null');
return 'response_payloads is null';
Expand Down

0 comments on commit 948e237

Please sign in to comment.