Enhancements from PR

This commit is contained in:
Francisco Gindre 2020-02-07 18:04:21 -03:00
parent b3d42304a9
commit 77cfb2c328
2 changed files with 2 additions and 2 deletions

View File

@ -344,7 +344,7 @@ public class CompactBlockProcessor {
func determineLowerBound(errorHeight: Int, consecutiveErrors: Int, walletBirthday: BlockHeight) -> BlockHeight {
let offset = min(ZcashSDK.MAX_REORG_SIZE, ZcashSDK.DEFAULT_REWIND_DISTANCE * (consecutiveErrors + 1))
return max(errorHeight - offset, walletBirthday)
return max(errorHeight - offset, walletBirthday - ZcashSDK.MAX_REORG_SIZE)
}
private func processBatchFinished(range: CompactBlockRange) {

View File

@ -141,7 +141,7 @@ class CompactBlockProcessorTests: XCTestCase {
let walletBirthday = 781_900
let result = processor.determineLowerBound(errorHeight: errorHeight, consecutiveErrors: 1, walletBirthday: walletBirthday)
let expected = 781_900
let expected = 781_886
XCTAssertEqual(result, expected)