Fix: repair the upgrade flow.
Existing users of seed-only wallets were getting stuck because the birthday is now stored differently. The previous fix was attempting to just load the latest checkpoint as the birthday but this does not work because the birthday determines how far back the wallet will rewind during a reorg. The end result prevented the wallet from going back as far as it needed. When the birthday isn't known, it makes logical sense to set it to the lowest possible number: Sapling Activation. This also happens to fix the problem because now wallets that are upgrading can rewind beyond the latest checkpoint.
This commit is contained in:
parent
245a265770
commit
500fa13cbd
|
@ -10,6 +10,7 @@ import cash.z.ecc.android.feedback.Report
|
||||||
import cash.z.ecc.android.lockbox.LockBox
|
import cash.z.ecc.android.lockbox.LockBox
|
||||||
import cash.z.ecc.android.sdk.Initializer
|
import cash.z.ecc.android.sdk.Initializer
|
||||||
import cash.z.ecc.android.sdk.exception.InitializerException
|
import cash.z.ecc.android.sdk.exception.InitializerException
|
||||||
|
import cash.z.ecc.android.sdk.ext.ZcashSdk
|
||||||
import cash.z.ecc.android.sdk.ext.twig
|
import cash.z.ecc.android.sdk.ext.twig
|
||||||
import cash.z.ecc.android.sdk.tool.DerivationTool
|
import cash.z.ecc.android.sdk.tool.DerivationTool
|
||||||
import cash.z.ecc.android.sdk.tool.WalletBirthdayTool
|
import cash.z.ecc.android.sdk.tool.WalletBirthdayTool
|
||||||
|
@ -140,7 +141,8 @@ class WalletSetupViewModel @Inject constructor() : ViewModel() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onMissingBirthday(): Int = failWith(InitializerException.MissingBirthdayException) {
|
private fun onMissingBirthday(): Int = failWith(InitializerException.MissingBirthdayException) {
|
||||||
loadNearestBirthday().height
|
twig("Recover Birthday: falling back to sapling birthday")
|
||||||
|
loadNearestBirthday(ZcashSdk.SAPLING_ACTIVATION_HEIGHT).height
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun loadNearestBirthday(birthdayHeight: Int? = null) =
|
private fun loadNearestBirthday(birthdayHeight: Int? = null) =
|
||||||
|
|
Loading…
Reference in New Issue