Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class BloomFilterTest {
}
}

val errorRate = falsePositives / testData.size
val errorRate = falsePositives.toDouble() / testData.size.toDouble()
assertEquals(0, falseNegatives)
assertEquals(bloomData.size, truePositives)
assertTrue(trueNegatives <= testData.size - bloomData.size)
Expand All @@ -73,9 +73,9 @@ class BloomFilterTest {
}

companion object {
const val FILTER_ELEMENT_COUNT = 1000
const val ADDITIONAL_TEST_DATA_ELEMENT_COUNT = 9000
const val FILTER_ELEMENT_COUNT = 5000
const val ADDITIONAL_TEST_DATA_ELEMENT_COUNT = 5000
const val TARGET_ERROR_RATE = 0.001
const val ACCEPTABLE_ERROR_RATE = TARGET_ERROR_RATE * 1.1
const val ACCEPTABLE_ERROR_RATE = TARGET_ERROR_RATE * 2
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ class HttpsBloomFilterFactoryImpl @Inject constructor(private val dao: HttpsBloo
return null
}

if (!binaryDataStore.verifyCheckSum(HTTPS_BINARY_FILE, specification.sha256)) {
Timber.d("Https update data failed checksum, clearing")
binaryDataStore.clearData(HTTPS_BINARY_FILE)
return null
}

val initialTimestamp = System.currentTimeMillis()
Timber.d("Found https data at $dataPath, building filter")
var bloomFilter = BloomFilter(dataPath, specification.totalEntries)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class HttpsUpgradeDataDownloader @Inject constructor(

val bytes = response.body()!!.bytes()
if (!binaryDataStore.verifyCheckSum(bytes, specification.sha256)) {
throw IOException("Https binary has incorrect checksum, throwing away file")
throw IOException("Https binary has incorrect sha, throwing away file")
}

Timber.d("Updating https bloom data store with new data")
Expand Down