Skip to content

Commit

Permalink
[FAB-10559] fix iter in GetPrivateDataQueryResult
Browse files Browse the repository at this point in the history
While creating an iterator for GetPrivateDataQueryResult
in the chaincode shim, we incorrectly assign value to
fields in the iterator object. For e.g., we assign
channelID to the txid field and txid to the channelID
field.

As a result, the peer is unable to get the txcontext while
processing the iter.next() and iter.close() call from
the shim.

This CR creates the correct iterator object and pass it
to the chaincode.

Change-Id: I360ad3e0768dd6f2bef8439d06d3967225f88a12
Signed-off-by: senthil <cendhu@gmail.com>
  • Loading branch information
cendhu committed Jun 14, 2018
1 parent 8b19d4e commit 449a18b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion core/chaincode/shim/chaincode.go
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,11 @@ func (stub *ChaincodeStub) GetPrivateDataQueryResult(collection, query string) (
if err != nil {
return nil, err
}
return &StateQueryIterator{CommonIterator: &CommonIterator{stub.handler, stub.TxID, stub.ChannelId, response, 0}}, nil
return &StateQueryIterator{CommonIterator: &CommonIterator{
handler: stub.handler,
channelId: stub.ChannelId,
txid: stub.TxID,
response: response}}, nil
}

// CommonIterator documentation can be found in interfaces.go
Expand Down

0 comments on commit 449a18b

Please sign in to comment.