Skip to content

Commit

Permalink
Fix for allow adding discovery tx hash for asset
Browse files Browse the repository at this point in the history
  • Loading branch information
Karolina Kosiorowska committed Jun 23, 2023
1 parent 12dce07 commit 546f8c5
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions background/services/indexing/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 546f8c5

Please sign in to comment.