fix(amm): cancel cached reads on endpoint change

This commit is contained in:
Ricardo Guilherme Schmidt
2026-07-18 19:55:15 -03:00
parent 91e07424dc
commit 8c18ffbe33
2 changed files with 19 additions and 1 deletions
+6 -1
View File
@@ -163,8 +163,13 @@ void SequencerClient::readAccount(const QString& accountId,
m_cache.remove(accountId);
if (!forceRefresh && m_cache.contains(accountId)) {
const WalletAccountRead cached = m_cache.value(accountId);
const quint64 generation = m_generation;
QTimer::singleShot(0, this,
[callback = std::move(callback), cached]() mutable { callback(cached); });
[this, callback = std::move(callback), cached, accountId,
generation]() mutable {
callback(generation == m_generation
? cached : WalletAccountRead { accountId });
});
return;
}
if (forceRefresh && m_activeReadIds.contains(accountId)) {