From 546f8c579bb0fe87ac9ffa7eb047f3be68acfa97 Mon Sep 17 00:00:00 2001 From: Karolina Kosiorowska Date: Fri, 23 Jun 2023 14:59:43 +0200 Subject: [PATCH] Fix for allow adding discovery tx hash for asset --- background/services/indexing/utils/index.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/background/services/indexing/utils/index.ts b/background/services/indexing/utils/index.ts index bc7bfece17..9f4044a7c6 100644 --- a/background/services/indexing/utils/index.ts +++ b/background/services/indexing/utils/index.ts @@ -51,14 +51,12 @@ export function shouldRefreshKnownAsset( const existingDiscoveryTxHash = addressForDiscoveryTxHash ? asset.metadata?.discoveryTxHash?.[addressForDiscoveryTxHash] : undefined - const noExistingDiscoveryTxHash = !!existingDiscoveryTxHash - // If the discovery tx hash is specified - // or if it does not already exists in the asset, do update the asset. - // However, this should only happen for untrusted assets. + // If the discovery tx hash is not specified + // or if it already exists in the asset, do not update the asset + // Additionally, discovery tx Hash should only be added for untrusted assets. const allowAddDiscoveryTxHash = - isUntrustedAsset(asset) && - (!!newDiscoveryTxHash || noExistingDiscoveryTxHash) + isUntrustedAsset(asset) && !(!newDiscoveryTxHash || existingDiscoveryTxHash) // Refresh a known unverified asset if it has been manually imported. // This check allows the user to add an asset from the unverified list.