Skip to content

Commit

Permalink
Fix membership actual query version
Browse files Browse the repository at this point in the history
  • Loading branch information
aalda committed Mar 8, 2019
1 parent 9647abb commit 914c538
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions balloon/balloon.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,11 @@ func (b Balloon) QueryDigestMembership(keyDigest hashing.Digest, version uint64)
proof.KeyDigest = keyDigest
proof.QueryVersion = version
proof.CurrentVersion = b.version - 1
if version > b.version {
version = b.version

if version > proof.CurrentVersion {
version = proof.CurrentVersion
}

leaf, err := b.store.Get(storage.IndexPrefix, proof.KeyDigest)
if err != nil {
return nil, fmt.Errorf("No leaf with digest %v", proof.KeyDigest)
Expand Down Expand Up @@ -295,7 +297,6 @@ func (b Balloon) QueryDigestMembership(keyDigest hashing.Digest, version uint64)

func (b Balloon) QueryMembership(event []byte, version uint64) (*MembershipProof, error) {
hasher := b.hasherF()

return b.QueryDigestMembership(hasher.Do(event), version)
}

Expand Down

0 comments on commit 914c538

Please sign in to comment.