Merge "pkg/index: fix corpus AppendClaims use of signerFilter"

This commit is contained in:
Mathieu Lonjaret 2018-01-24 17:42:56 +00:00 committed by Gerrit Code Review
commit f75c16a1f8
1 changed files with 16 additions and 1 deletions

View File

@ -1297,13 +1297,28 @@ func (c *Corpus) AppendClaims(ctx context.Context, dst []camtypes.Claim, permaNo
if !ok {
return nil, nil
}
var signerRefs signerRefSet
if signerFilter.Valid() {
signer, ok := c.keyId[signerFilter]
if !ok {
return dst, nil
}
signerRefs, ok = c.signerRefs[signer]
if !ok {
return dst, nil
}
}
for _, cl := range pm.Claims {
if c.IsDeleted(cl.BlobRef) {
continue
}
if signerFilter.Valid() && cl.Signer != signerFilter {
if len(signerRefs) > 0 && !signerRefs.blobMatches(cl.Signer) {
continue
}
if attrFilter != "" && cl.Attr != attrFilter {
continue
}