block possible ordinal containing utxos

This commit is contained in:
julian 2023-05-24 13:02:36 -06:00
parent 0933546806
commit d7aa8134d3

View file

@ -1793,6 +1793,27 @@ class LitecoinWallet extends CoinServiceAPI
coin: coin, coin: coin,
); );
final storedTx = await db.getTransaction(
walletId,
jsonUTXO["tx_hash"] as String,
);
bool shouldBlock = false;
String? blockReason;
String? label;
if (storedTx?.amountString != null) {
final amount = Amount.fromSerializedJsonString(
storedTx!.amountString!,
);
if (amount.raw <= BigInt.from(10000)) {
shouldBlock = true;
blockReason = "May contain ordinal";
label = "Possible ordinal";
}
}
final vout = jsonUTXO["tx_pos"] as int; final vout = jsonUTXO["tx_pos"] as int;
final outputs = txn["vout"] as List; final outputs = txn["vout"] as List;
@ -1812,9 +1833,9 @@ class LitecoinWallet extends CoinServiceAPI
txid: txn["txid"] as String, txid: txn["txid"] as String,
vout: vout, vout: vout,
value: jsonUTXO["value"] as int, value: jsonUTXO["value"] as int,
name: "", name: label ?? "",
isBlocked: false, isBlocked: shouldBlock,
blockedReason: null, blockedReason: blockReason,
isCoinbase: txn["is_coinbase"] as bool? ?? false, isCoinbase: txn["is_coinbase"] as bool? ?? false,
blockHash: txn["blockhash"] as String?, blockHash: txn["blockhash"] as String?,
blockHeight: jsonUTXO["height"] as int?, blockHeight: jsonUTXO["height"] as int?,