Skip to content

Commit

Permalink
IOS-7486 Exclude Cardano UTXO with incorrect asset hex name (#814)
Browse files Browse the repository at this point in the history
  • Loading branch information
Balashov152 committed Aug 26, 2024
1 parent 7e265cd commit 47caf42
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,19 @@ class CardanoTransactionBuilder {

extension CardanoTransactionBuilder {
func update(outputs: [CardanoUnspentOutput]) {
self.outputs = outputs
self.outputs = outputs.filter { output in
let containsIncorrectAssetNameHex = output.assets.contains(where: { asset in
// We have to exclude assets with the incorrect hex name like `000de14064655f76696c6c69657273`
// Which fails to meet utf8 standards
String(data: Data(hexString: asset.assetNameHex), encoding: .utf8) == nil
})

if containsIncorrectAssetNameHex {
Log.debug("CardanoTransactionBuilder will exclude output: \(output)")
}

return !containsIncorrectAssetNameHex
}
}

func buildForSign(transaction: Transaction) throws -> Data {
Expand Down

0 comments on commit 47caf42

Please sign in to comment.