[#1308] Enhancing seems to not process all ranges

- The enhance action is driven by lastEnhancedHeight value. The range is computed from it and every 1000 blocks are enhanced. The value hasn't been reseted with the new suggested ScanRanges so when some higher ranges were processed first, all lower heights were skipped
- fixed and covered with the unit test

[#1308] Enhancing seems to not process all ranges (#1309)

- changelog update
This commit is contained in:
Lukas Korba 2023-10-20 09:48:51 +02:00
parent c1cc041ab0
commit ab23f15fa1
3 changed files with 15 additions and 0 deletions

View File

@ -4,6 +4,13 @@ All notable changes to this library will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this library adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
# 2.0.3 - 2023-10-20
## Fixed
### [#1308] Enhancing seems to not process all ranges
The enhancing of the transactions now processes all the blocks suggested by scan ranges. The issue was that when new scan ranges were suggested the value that drives the enhancing range computation wasn't reseted so when higher ranges were processed, the lower ranges were skipped. This fix ensures all transaction data are properly set as well as fixes eventStream `.foundTransaction` reporting.
# 2.0.2 - 2023-10-12
## Changed

View File

@ -43,6 +43,7 @@ extension ProcessSuggestedScanRangesAction: Action {
firstUnenhancedHeight [DB]: \(rangeStartExclusive + 1)
""")
await context.update(lastEnhancedHeight: nil)
await context.update(lastScannedHeight: rangeStartExclusive)
await context.update(lastDownloadedHeight: rangeStartExclusive)
await context.update(syncControlData: syncControlData)

View File

@ -66,6 +66,7 @@ final class ProcessSuggestedScanRangesActionTests: ZcashTestCase {
do {
let context = ActionContextMock.default()
context.updateLastEnhancedHeightClosure = { _ in }
context.updateLastScannedHeightClosure = { _ in }
context.updateLastDownloadedHeightClosure = { _ in }
context.updateSyncControlDataClosure = { _ in }
@ -78,6 +79,12 @@ final class ProcessSuggestedScanRangesActionTests: ZcashTestCase {
nextContextMock.updateRequestedRewindHeightCalled,
"context.update(requestedRewindHeight:) is not expected to be called"
)
let enhancedValue = nextContextMock.updateLastEnhancedHeightReceivedLastEnhancedHeight
XCTAssertNil(
enhancedValue,
"context.update(updateLastEnhancedHeight:) is expected to reset the value to nil but received \(enhancedValue)"
)
} else {
XCTFail("`nextContext` is not the ActionContextMock")
}