refresh inscriptions after general refresh if any are detected

This commit is contained in:
sneurlax 2023-07-23 18:01:51 -05:00
parent 7da49c7ea0
commit f32359ac1e

View file

@ -1856,6 +1856,7 @@ class LitecoinWallet extends CoinServiceAPI
} }
final List<isar_models.UTXO> outputArray = []; final List<isar_models.UTXO> outputArray = [];
bool inscriptionsRefreshNeeded = false;
for (int i = 0; i < fetchedUtxoList.length; i++) { for (int i = 0; i < fetchedUtxoList.length; i++) {
for (int j = 0; j < fetchedUtxoList[i].length; j++) { for (int j = 0; j < fetchedUtxoList[i].length; j++) {
@ -1890,10 +1891,12 @@ class LitecoinWallet extends CoinServiceAPI
// TODO check the specific output, not just the address in general // TODO check the specific output, not just the address in general
// TODO optimize by querying the litescribe API for all addresses at once, instead of one API call per output // TODO optimize by querying the litescribe API for all addresses at once, instead of one API call per output
if (utxoOwnerAddress != null) { if (utxoOwnerAddress != null) {
// TODO add inscription to database
if (await inscriptionInAddress(utxoOwnerAddress!)) { if (await inscriptionInAddress(utxoOwnerAddress!)) {
shouldBlock = true; shouldBlock = true;
blockReason = "Ordinal"; blockReason = "Ordinal";
label = "Ordinal detected at address"; label = "Ordinal detected at address";
inscriptionsRefreshNeeded = true;
} }
} else { } else {
// TODO implement inscriptionInOutput // TODO implement inscriptionInOutput
@ -1901,6 +1904,7 @@ class LitecoinWallet extends CoinServiceAPI
shouldBlock = true; shouldBlock = true;
blockReason = "May contain ordinal"; blockReason = "May contain ordinal";
label = "Possible ordinal"; label = "Possible ordinal";
inscriptionsRefreshNeeded = true;
} }
} }
@ -1923,6 +1927,10 @@ class LitecoinWallet extends CoinServiceAPI
} }
} }
if (inscriptionsRefreshNeeded) {
await refreshInscriptions();
}
Logging.instance.log( Logging.instance.log(
'Outputs fetched: $outputArray', 'Outputs fetched: $outputArray',
level: LogLevel.Info, level: LogLevel.Info,