Skip to content

Commit

Permalink
some docs and variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
buck54321 committed Apr 1, 2020
1 parent 82a3da9 commit f99be5f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions decred/decred/crypto/gcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def readNBits(self, n):

class FilterV2:
"""
A GCS filter for determining probabilistic set membership.
A GCS filter for determining set membership with a 1/M false positive rate.
"""

def __init__(self, n, filterData):
Expand Down Expand Up @@ -200,14 +200,14 @@ def match(self, key, data):
term = (term * self.modulusNM) >> 64

# Go through the search filter and look for the desired value.
br = BitReader(self.filterData)
bitStream = BitReader(self.filterData)
lastValue = 0
uint64 = self.readFullUint64
readInt = self.readFullUint64
while lastValue <= term:
# Read the difference between previous and new value from
# bitstream.
try:
value = uint64(br)
value = readInt(bitStream)
except EncodingError: # out of bytes
return False

Expand Down Expand Up @@ -254,16 +254,16 @@ def matchAny(self, key, data):

# Zip down the filters, comparing values until we either run out of
# values to compare in one of the filters or we reach a matching value.
br = BitReader(self.filterData)
bitStream = BitReader(self.filterData)
searchSize = len(data)
searchIdx = 0
filterVal = 0

uint64 = self.readFullUint64
readInt = self.readFullUint64
for i in range(self.n):
# Read the next item to compare from the filter.
try:
delta = uint64(br)
delta = readInt(bitStream)
except EncodingError: # out of bytes
return False

Expand Down

0 comments on commit f99be5f

Please sign in to comment.