Merge pull request #1309 from LukasKorba/1308-Enhancing-seems-to-not-process-all-ranges

[#1308] Enhancement seems to not process all ranges
This commit is contained in:
Lukas Korba 2023-10-20 10:49:05 +02:00 committed by GitHub
commit bd3ec59f09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 reset, so when higher ranges were processed, the lower ranges were skipped. This fix ensures all transaction data are properly set, as well as fixing 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")
}