Repository navigation
bug: home total balance shows — until the usdt rate refreshes #1698
Description
Twin: synonymdev/bitkit-ios#1129
Refs:
- bug: new usdt wallet shows error and sync copy under the balance #1648
- fix: unify usdt balance and amount presentation #1655
- feat: add usdt wallet and paykit payments #1432
What happened?
On mainnet, right after installing a new build over an existing install and opening it, the Home total balance shows ₿ — and € — for a few seconds. Savings, Spending and the USDT tile already show their amounts, and the activity rows already show fiat values, so fiat rates were loaded. The total fills in a few seconds later.
Cause:
- With USDT shown,
HomeScreen.ktsetsisUnavailable = usdtSats == nullonBalanceHeaderView, which then renders—in both rows. usdtSatsis null in two cases:- The USDT balance has not been read yet.
UsdtRepokeeps it in memory only, so it isnullafter every launch untilwallet.balance()returns. - No usable rate.
usdtDisplaySatscallsPaykitExchangeRate.value(now), which throws when the rate is older thanMAX_AGE_MILLIS(10 minutes).CurrencyRepodoes load the cached rates fromCacheStoreat launch, but after the app was closed for more than 10 minutes they all fail this check, so the header waits for the network.
- The USDT balance has not been read yet.
- The 10-minute limit guards payment amounts. The Home total is display only.
- The header
—came with feat: add usdt wallet and paykit payments #1432. fix: unify usdt balance and amount presentation #1655 (for bug: new usdt wallet shows error and sync copy under the balance #1648) made an unknown USDT balance produce it too. The—fits the USDT wallet's own amount, but on Home it also hides the bitcoin part of the total, which is known.
Expected behavior
Show the last known total at once, then refresh it:
- Cache the sats value of the USDT balance (and the rate it used), and the USDT balance itself.
- On launch, show the total from the cached values.
- While the balance or rate refreshes, show an indicator that makes clear the total is updating, instead of
—. - When fresh values arrive, update the total as it already does when rates change.
Steps to Reproduce
- Mainnet wallet with USDT enabled and a USDT balance.
- Install a new build over the existing install, or force-close the app for more than 10 minutes.
- Open it and look at the Home total balance.
Logs / Screenshots / Recordings
Home right after launch, balances and activity masked:
Bitkit Version
Mainnet debug build from #1697, which does not touch this code; the same code path is on master at 3ad6193b2.
Device / OS
Pixel 10 Pro.
Reproducibility
Seen on first launch after installing a new build. From the code, expected on every launch where the cached rate is older than 10 minutes or the USDT balance is not read yet.
Activity
ovitrif commentedon Oct 26, 2026
@ben-kaufman assigning this to you. Should I let an AI implement it, or would you rather take it? And what do you think of the caching proposal above?