Electric-Coin-Company / zcash-android-wallet-sdk

Native Android SDK for Zcash
MIT License
5 stars 10 forks source link

Immediately refresh wallet balance and sync progress on synchronizer start #1362

Closed str4d closed 9 months ago

str4d commented 9 months ago

Currently, when a new SdkSynchronizer is created, it triggers CompactBlockProcessor.start(), which begins the sync process. SdkSynchronizer also exposes StateFlows for things like the wallet's Sapling balance. AFAICT these balance StateFlows are only updated once CompactBlockProcessor has successfully scanned at least one block. This leads to an artificial delay between opening an app, and the app being able to display balances and a non-zero sync percentage.

I think it is safe to just call getWalletSummary() immediately inside CompactBlockProcessor.start() (even before verifySetup()). By the time we call CompactBlockProcessor.start(), the wallet database has been created, so this just exposes its data to the SDK user.

str4d commented 9 months ago

Oops, this was a duplicate of #1310.