From bf2331de7612529f9c2ad892a1cd32b388d809cb Mon Sep 17 00:00:00 2001 From: sneurlax Date: Fri, 12 Jan 2024 16:59:25 -0600 Subject: [PATCH] update particl checkBlockUTXO --- lib/wallets/wallet/impl/particl_wallet.dart | 36 +++++++++++++++++---- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/lib/wallets/wallet/impl/particl_wallet.dart b/lib/wallets/wallet/impl/particl_wallet.dart index dcaf922ee..92dd19963 100644 --- a/lib/wallets/wallet/impl/particl_wallet.dart +++ b/lib/wallets/wallet/impl/particl_wallet.dart @@ -56,10 +56,33 @@ class ParticlWallet extends Bip39HDWallet Future<({bool blocked, String? blockedReason, String? utxoLabel})> checkBlockUTXO(Map jsonUTXO, String? scriptPubKeyHex, Map jsonTX, String? utxoOwnerAddress) async { - // Particl doesn't have special outputs like tokens, ordinals, etc. - // But it may have special types of outputs which we shouldn't or can't spend. - // TODO: [prio=low] Check for special Particl outputs. - return (blocked: false, blockedReason: null, utxoLabel: null); + bool blocked = false; + String? blockedReason; + String? utxoLabel; + if (jsonUTXO.containsKey('ct_fee')) { + // Blind output, ignore for now. + blocked = true; + blockedReason = "Blind output."; + utxoLabel = "Unsupported output type."; + } else if (jsonUTXO.containsKey('rangeproof')) { + // Private RingCT output, ignore for now. + blocked = true; + blockedReason = "Confidential output."; + utxoLabel = "Unsupported output type."; + } else if (jsonUTXO.containsKey('data_hex')) { + // Data output, ignore for now. + blocked = true; + blockedReason = "Data output."; + utxoLabel = "Unsupported output type."; + } else if (jsonUTXO.containsKey('scriptPubKey')) { + // Transparent output. Do nothing. + } + + return ( + blocked: blocked, + blockedReason: blockedReason, + utxoLabel: utxoLabel + ); } @override @@ -250,9 +273,8 @@ class ParticlWallet extends Bip39HDWallet // Most likely just a typical send, do nothing here yet. } - // Particl has special outputs like confidential amounts. - // This is where we should check for them. - // TODO: [prio=high] Check for special Particl outputs. + // Particl has special outputs like confidential amounts. We can check + // for them here. They're also checked in checkBlockUTXO. } } else if (wasReceivedInThisWallet) { // Only found outputs owned by this wallet.