Enhancements from PR
This commit is contained in:
parent
b3d42304a9
commit
77cfb2c328
|
@ -344,7 +344,7 @@ public class CompactBlockProcessor {
|
||||||
|
|
||||||
func determineLowerBound(errorHeight: Int, consecutiveErrors: Int, walletBirthday: BlockHeight) -> BlockHeight {
|
func determineLowerBound(errorHeight: Int, consecutiveErrors: Int, walletBirthday: BlockHeight) -> BlockHeight {
|
||||||
let offset = min(ZcashSDK.MAX_REORG_SIZE, ZcashSDK.DEFAULT_REWIND_DISTANCE * (consecutiveErrors + 1))
|
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) {
|
private func processBatchFinished(range: CompactBlockRange) {
|
||||||
|
|
|
@ -141,7 +141,7 @@ class CompactBlockProcessorTests: XCTestCase {
|
||||||
let walletBirthday = 781_900
|
let walletBirthday = 781_900
|
||||||
|
|
||||||
let result = processor.determineLowerBound(errorHeight: errorHeight, consecutiveErrors: 1, walletBirthday: walletBirthday)
|
let result = processor.determineLowerBound(errorHeight: errorHeight, consecutiveErrors: 1, walletBirthday: walletBirthday)
|
||||||
let expected = 781_900
|
let expected = 781_886
|
||||||
|
|
||||||
XCTAssertEqual(result, expected)
|
XCTAssertEqual(result, expected)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue