debug: log Tron chain arrival + gate evaluation in BalancesUpdateSystem

TRX is completely absent from the Assets list even for a brand-new
wallet on a completely fresh install - ruled out per-account backfill
(fresh wallet correctly derives tronAddress) and stale per-device chain
state (fresh install, no carried-over connectionState). Need to see
empirically whether the Tron chain even reaches currentChains at all,
and if so, which of hasAccountIn/connectionState.isDisabled gates it.
This commit is contained in:
2026-07-10 17:25:31 -07:00
parent 5f5f74989a
commit 7f071f4821
@@ -39,12 +39,24 @@ class BalancesUpdateSystem(
override fun start(): Flow<Updater.SideEffect> {
return accountUpdateScope.invalidationFlow().flatMapLatest { metaAccount ->
chainRegistry.currentChains.transformLatestDiffed { chain ->
if (chain.isTronBased) {
Log.d(LOG_TAG, "TronDebug: currentChains delivered chain=${chain.id} name=${chain.name}")
}
emitAll(balancesSync(chain, metaAccount))
}
}.flowOn(Dispatchers.Default)
}
private suspend fun balancesSync(chain: Chain, metaAccount: MetaAccount): Flow<Updater.SideEffect> {
if (chain.isTronBased) {
Log.d(
LOG_TAG,
"TronDebug: gate check chain=${chain.id} name=${chain.name} hasAccountIn=${metaAccount.hasAccountIn(chain)} " +
"connectionState=${chain.connectionState} isDisabled=${chain.connectionState.isDisabled} " +
"hasSubstrateRuntime=${chain.hasSubstrateRuntime} canPerformFullSync=${chain.canPerformFullSync()}"
)
}
return when {
!metaAccount.hasAccountIn(chain) -> emptyFlow()
chain.connectionState.isDisabled -> emptyFlow()