Skip to content

Commit 195bd43

Browse files
committed
fix: rotate address at restore time
1 parent 121d8c8 commit 195bd43

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

app/src/main/java/to/bitkit/repositories/BackupRepo.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ class BackupRepo @Inject constructor(
367367

368368
BackupCategory.METADATA -> {
369369
val tagMetadata = db.tagMetadataDao().getAll()
370-
val cacheData = cacheStore.data.first().copy(onchainAddress = "") // Force onchain address rotation
370+
val cacheData = cacheStore.data.first()
371371

372372
val payload = MetadataBackupV1(
373373
createdAt = currentTimeMillis(),
@@ -417,7 +417,8 @@ class BackupRepo @Inject constructor(
417417
return@withContext try {
418418
performRestore(BackupCategory.METADATA) { dataBytes ->
419419
val parsed = json.decodeFromString<MetadataBackupV1>(String(dataBytes))
420-
cacheStore.update { parsed.cache }
420+
val caches = parsed.cache.copy(onchainAddress = "") // Force onchain address rotation
421+
cacheStore.update { caches }
421422
Logger.debug("Restored caches: ${jsonLogOf(parsed.cache.copy(cachedRates = emptyList()))}", TAG)
422423
onCacheRestored()
423424
db.tagMetadataDao().upsert(parsed.tagMetadata)

0 commit comments

Comments
 (0)