Skip to content

Commit

Permalink
Fix Issue FAB-919 Failed to read CertificatePair
Browse files Browse the repository at this point in the history
The function "ReadCertificatePair" in fabric/membersrvc/ca/ecap.go
indicates that only one columns-- "cert" should be returned,
but instead, there are two columns-- "cert, kdfkey" being read out
at function "readCertificates" of fabric/membersrvc/ca/ca.go.

https://jira.hyperledger.org/browse/FAB-919

Change-Id: I2bbb865a2da47cff73dd3de344a3ddab969c21d0
Signed-off-by: Hangyu Li <li.hangyu@jp.fujitsu.com>
  • Loading branch information
lihangyu committed Jan 30, 2017
1 parent 70f6a23 commit 4491e28
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions membersrvc/ca/ca.go
Original file line number Diff line number Diff line change
Expand Up @@ -490,10 +490,10 @@ func (ca *CA) readCertificates(id string, opt ...int64) (*sql.Rows, error) {
defer mutex.RUnlock()

if len(opt) > 0 && opt[0] != 0 {
return ca.db.Query("SELECT cert, kdfkey FROM Certificates WHERE id=? AND timestamp=? ORDER BY usage", id, opt[0])
return ca.db.Query("SELECT cert FROM Certificates WHERE id=? AND timestamp=? ORDER BY usage", id, opt[0])
}

return ca.db.Query("SELECT cert, kdfkey FROM Certificates WHERE id=?", id)
return ca.db.Query("SELECT cert FROM Certificates WHERE id=?", id)
}

func (ca *CA) readCertificateSets(id string, start, end int64) (*sql.Rows, error) {
Expand All @@ -502,7 +502,7 @@ func (ca *CA) readCertificateSets(id string, start, end int64) (*sql.Rows, error
mutex.RLock()
defer mutex.RUnlock()

return ca.db.Query("SELECT cert, kdfKey, timestamp FROM Certificates WHERE id=? AND timestamp BETWEEN ? AND ? ORDER BY timestamp", id, start, end)
return ca.db.Query("SELECT cert, timestamp FROM Certificates WHERE id=? AND timestamp BETWEEN ? AND ? ORDER BY timestamp", id, start, end)
}

func (ca *CA) readCertificateByHash(hash []byte) ([]byte, error) {
Expand Down

0 comments on commit 4491e28

Please sign in to comment.