From 7babe0c63cfb3ebb55fda8f8e8a298cc4b96e19a Mon Sep 17 00:00:00 2001 From: Kevin Gorham Date: Mon, 23 Dec 2019 14:47:58 -0500 Subject: [PATCH] Fixed bug with hasData not being cleared and improved sapling tree selection. - Choose the latest tree above the requested height --- src/main/java/cash/z/wallet/sdk/Initializer.kt | 8 +++++--- .../assets/zcash/saplingtree/{400000.json => 643500.json} | 0 2 files changed, 5 insertions(+), 3 deletions(-) rename src/zcashmainnet/assets/zcash/saplingtree/{400000.json => 643500.json} (100%) diff --git a/src/main/java/cash/z/wallet/sdk/Initializer.kt b/src/main/java/cash/z/wallet/sdk/Initializer.kt index b05a426a..3a7364a5 100644 --- a/src/main/java/cash/z/wallet/sdk/Initializer.kt +++ b/src/main/java/cash/z/wallet/sdk/Initializer.kt @@ -183,6 +183,7 @@ class Initializer( */ fun clear() { rustBackend.clear() + prefs[PREFS_HAS_DATA] = false } /** @@ -294,9 +295,10 @@ class Initializer( ) val file: String try { - file = treeFiles.first() { - if (birthdayHeight == null) true - else it.contains(birthdayHeight.toString()) + file = if (birthdayHeight == null) treeFiles.first() else { + treeFiles.first { + it.split(".").first().toInt() <= birthdayHeight + } } } catch (t: Throwable) { throw BirthdayException.BirthdayFileNotFoundException( diff --git a/src/zcashmainnet/assets/zcash/saplingtree/400000.json b/src/zcashmainnet/assets/zcash/saplingtree/643500.json similarity index 100% rename from src/zcashmainnet/assets/zcash/saplingtree/400000.json rename to src/zcashmainnet/assets/zcash/saplingtree/643500.json