[#1184] FirstUnenhancedHeight not called
- firstUnenhancedHeight is now properly used - fixed tests
This commit is contained in:
parent
b9524ae1ab
commit
ad99fdeae8
|
@ -29,6 +29,7 @@ extension ComputeSyncControlDataAction: Action {
|
|||
|
||||
await latestBlocksDataProvider.updateScannedData()
|
||||
await latestBlocksDataProvider.updateBlockData()
|
||||
await latestBlocksDataProvider.updateUnenhancedData()
|
||||
|
||||
// Here we know:
|
||||
// - latest scanned height from the DB, if none the wallet's birthday is automatically used
|
||||
|
|
|
@ -16,6 +16,7 @@ protocol LatestBlocksDataProvider {
|
|||
|
||||
func updateScannedData() async
|
||||
func updateBlockData() async
|
||||
func updateUnenhancedData() async
|
||||
func updateWalletBirthday(_ walletBirthday: BlockHeight) async
|
||||
func updateLatestScannedHeight(_ latestScannedHeight: BlockHeight) async
|
||||
func updateLatestScannedTime(_ latestScannedTime: TimeInterval) async
|
||||
|
@ -57,6 +58,10 @@ actor LatestBlocksDataProviderImpl: LatestBlocksDataProvider {
|
|||
}
|
||||
}
|
||||
|
||||
func updateUnenhancedData() async {
|
||||
firstUnenhancedHeight = try? transactionRepository.firstUnenhancedHeight()
|
||||
}
|
||||
|
||||
func updateWalletBirthday(_ walletBirthday: BlockHeight) async {
|
||||
self.walletBirthday = walletBirthday
|
||||
}
|
||||
|
|
|
@ -135,6 +135,7 @@ final class ComputeSyncControlDataActionTests: ZcashTestCase {
|
|||
latestBlocksDataProviderMock.underlyingLatestScannedHeight = 1
|
||||
latestBlocksDataProviderMock.updateScannedDataClosure = { }
|
||||
latestBlocksDataProviderMock.updateBlockDataClosure = { }
|
||||
latestBlocksDataProviderMock.updateUnenhancedDataClosure = { }
|
||||
loggerMock.debugFileFunctionLineClosure = { _, _, _, _ in }
|
||||
|
||||
return setupAction(
|
||||
|
|
|
@ -546,6 +546,19 @@ class LatestBlocksDataProviderMock: LatestBlocksDataProvider {
|
|||
await updateBlockDataClosure!()
|
||||
}
|
||||
|
||||
// MARK: - updateUnenhancedData
|
||||
|
||||
var updateUnenhancedDataCallsCount = 0
|
||||
var updateUnenhancedDataCalled: Bool {
|
||||
return updateUnenhancedDataCallsCount > 0
|
||||
}
|
||||
var updateUnenhancedDataClosure: (() async -> Void)?
|
||||
|
||||
func updateUnenhancedData() async {
|
||||
updateUnenhancedDataCallsCount += 1
|
||||
await updateUnenhancedDataClosure!()
|
||||
}
|
||||
|
||||
// MARK: - updateWalletBirthday
|
||||
|
||||
var updateWalletBirthdayCallsCount = 0
|
||||
|
@ -2613,29 +2626,27 @@ actor ZcashRustBackendWeldingMock: ZcashRustBackendWelding {
|
|||
|
||||
// MARK: - scanBlocks
|
||||
|
||||
var scanBlocksLimitThrowableError: Error?
|
||||
func setScanBlocksLimitThrowableError(_ param: Error?) async {
|
||||
scanBlocksLimitThrowableError = param
|
||||
var scanBlocksFromHeightLimitThrowableError: Error?
|
||||
func setScanBlocksFromHeightLimitThrowableError(_ param: Error?) async {
|
||||
scanBlocksFromHeightLimitThrowableError = param
|
||||
}
|
||||
var scanBlocksLimitCallsCount = 0
|
||||
var scanBlocksLimitCalled: Bool {
|
||||
return scanBlocksLimitCallsCount > 0
|
||||
var scanBlocksFromHeightLimitCallsCount = 0
|
||||
var scanBlocksFromHeightLimitCalled: Bool {
|
||||
return scanBlocksFromHeightLimitCallsCount > 0
|
||||
}
|
||||
var scanBlocksLimitReceivedFromHeight: Int32?
|
||||
var scanBlocksLimitReceivedLimit: UInt32?
|
||||
var scanBlocksLimitClosure: ((Int32, UInt32) async throws -> Void)?
|
||||
func setScanBlocksLimitClosure(_ param: ((Int32, UInt32) async throws -> Void)?) async {
|
||||
scanBlocksLimitClosure = param
|
||||
var scanBlocksFromHeightLimitReceivedArguments: (fromHeight: Int32, limit: UInt32)?
|
||||
var scanBlocksFromHeightLimitClosure: ((Int32, UInt32) async throws -> Void)?
|
||||
func setScanBlocksFromHeightLimitClosure(_ param: ((Int32, UInt32) async throws -> Void)?) async {
|
||||
scanBlocksFromHeightLimitClosure = param
|
||||
}
|
||||
|
||||
func scanBlocks(fromHeight: Int32, limit: UInt32) async throws {
|
||||
if let error = scanBlocksLimitThrowableError {
|
||||
if let error = scanBlocksFromHeightLimitThrowableError {
|
||||
throw error
|
||||
}
|
||||
scanBlocksLimitCallsCount += 1
|
||||
scanBlocksLimitReceivedFromHeight = fromHeight
|
||||
scanBlocksLimitReceivedLimit = limit
|
||||
try await scanBlocksLimitClosure!(fromHeight, limit)
|
||||
scanBlocksFromHeightLimitCallsCount += 1
|
||||
scanBlocksFromHeightLimitReceivedArguments = (fromHeight: fromHeight, limit: limit)
|
||||
try await scanBlocksFromHeightLimitClosure!(fromHeight, limit)
|
||||
}
|
||||
|
||||
// MARK: - putUnspentTransparentOutput
|
||||
|
|
|
@ -142,7 +142,7 @@ class RustBackendMockHelper {
|
|||
try await rustBackend.suggestScanRanges()
|
||||
}
|
||||
|
||||
await rustBackendMock.setScanBlocksLimitClosure() { fromHeight, limit in
|
||||
await rustBackendMock.setScanBlocksFromHeightLimitClosure() { fromHeight, limit in
|
||||
try await rustBackend.scanBlocks(fromHeight: fromHeight, limit: limit)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue