Fix PQ background cache handling and rescan version

This commit is contained in:
Vexta Project 2026-09-05 22:39:02 +00:00
commit e27f5ef27d
2 changed files with 32 additions and 28 deletions

View file

@ -124,7 +124,7 @@ class WalletActivity : FragmentActivity() {
"last_header_height" "last_header_height"
private const val PREF_BACKGROUND_TX_HISTORY_VERSION = private const val PREF_BACKGROUND_TX_HISTORY_VERSION =
"background_transaction_history_version" "background_transaction_history_version"
private const val BACKGROUND_TX_HISTORY_VERSION = 4 private const val BACKGROUND_TX_HISTORY_VERSION = 5
private const val PREF_FIAT_CURRENCY = private const val PREF_FIAT_CURRENCY =
"preferred_fiat_currency" "preferred_fiat_currency"

View file

@ -59,7 +59,7 @@ class WalletMonitoringService : Service() {
"background_transaction_history" "background_transaction_history"
private const val PREF_BACKGROUND_TX_HISTORY_VERSION = private const val PREF_BACKGROUND_TX_HISTORY_VERSION =
"background_transaction_history_version" "background_transaction_history_version"
private const val BACKGROUND_TX_HISTORY_VERSION = 4 private const val BACKGROUND_TX_HISTORY_VERSION = 5
} }
private fun backgroundUtxoKey( private fun backgroundUtxoKey(
@ -195,25 +195,39 @@ class WalletMonitoringService : Service() {
) )
} }
val mldsaAddressCreated =
preferences.getBoolean(
PREF_MLDSA_ADDRESS_CREATED,
false
)
val slhdsaAddressCreated =
preferences.getBoolean(
PREF_SLHDSA_ADDRESS_CREATED,
false
)
val mldsaCacheAvailable = val mldsaCacheAvailable =
(0..highestMldsaAddressIndex).all { addressIndex -> !mldsaAddressCreated ||
preferences.contains( (0..highestMldsaAddressIndex).all { addressIndex ->
backgroundUtxoKey( preferences.contains(
BlockScanner.AddressType.MLDSA, backgroundUtxoKey(
addressIndex BlockScanner.AddressType.MLDSA,
addressIndex
)
) )
) }
}
val slhdsaCacheAvailable = val slhdsaCacheAvailable =
(0..highestSlhdsaAddressIndex).all { addressIndex -> !slhdsaAddressCreated ||
preferences.contains( (0..highestSlhdsaAddressIndex).all { addressIndex ->
backgroundUtxoKey( preferences.contains(
BlockScanner.AddressType.SLHDSA, backgroundUtxoKey(
addressIndex BlockScanner.AddressType.SLHDSA,
addressIndex
)
) )
) }
}
val backgroundCacheAvailable = val backgroundCacheAvailable =
standardCacheAvailable && standardCacheAvailable &&
@ -271,12 +285,7 @@ class WalletMonitoringService : Service() {
) )
} }
if ( if (mldsaAddressCreated) {
preferences.getBoolean(
PREF_MLDSA_ADDRESS_CREATED,
false
)
) {
for ( for (
addressIndex in addressIndex in
0..highestMldsaAddressIndex 0..highestMldsaAddressIndex
@ -295,12 +304,7 @@ class WalletMonitoringService : Service() {
} }
} }
if ( if (slhdsaAddressCreated) {
preferences.getBoolean(
PREF_SLHDSA_ADDRESS_CREATED,
false
)
) {
for ( for (
addressIndex in addressIndex in
0..highestSlhdsaAddressIndex 0..highestSlhdsaAddressIndex