Closes#579
This is what happens when database was locked:
- App is syncing.
- While rustBackend.scanBlocks(…) is in progress app goes to background. Background task is launched and
ECC works for some time in background.
- When background task is finished synchronizer.stop() is called.
- Inside CompactBlockProcessor.stop()is called. In this method cancelableTask is canceled and state is
set to stopped no matter what. And this is the problem. Because even when canceled is called rust
scanning isn’t canceled. But state doesn’t care about it. And next time when app is launched new
synchronisation is started and now you have processing code running in two threads causing DB lock.
So I moved setting state to stopped to processNewBlocks method. It's set
after the work is canceled and really stopped. When doing this there is
still one problem. When app goes to foreground new sync is not started
and current one is just stopped.
So I added new variable and condition. And when this variable is set
to true new syncing process starts when the previous one is canceled.
This should cover all the problems.
- Test was failling with:
generalError(message: "block not found in cache, should always be in cache in darkside mode")
- There was no wait so lightwalletd in darkside mode didn't have enough time to accept mocked state.
- Sample app refactored for the processor being an actor
- tests refactored as well
- dark side tests fixed
- utilities separated to new file
- synchronizer's start and stop are no longer in async context
- updating the UI for the scan fixed
Currently a 100 batch can take up to 3 minutes to scan. decrease the size of the batches when the increased load part of the chain is reached until a faster sync is implemented
See related counterpart to remove it issue #576Closes#577
Fix tests.
Fix tests.
Use Account 6 vectors on testListTransparentReceivers
only use first tree addresses from the vector for testListTransparentReceivers
Fix unified address generation tests.
Fix build and PR suggestions
- blocking API removed, only latestBlockHeight() stayed
- non-blocking closure based API removed
- unit tests updated to use async API
[#492] Get rid of blocking API (#551)
- forgotten commented code cleaned up
- some comments were still mentioning result (completion closure), removed
MultiThreadedEventLoopGroup has been replaced with NIOTSEventLoopGroup. It's recommended by authors of grpc-swift especially for iOS platform and it allows us to set the priority because NIOTSEventLoopGroup is GCD based while MultiThreadedEventLoopGroup is pthread based.
[#541] Initialise gRPC on a separate thread (#545)
- priority increased to .default