fix: refresh BTC balances from chain instead of Trust/TokenView totals

Webhook and ingest were writing Trust/client numbers (often sats or lifetime received) into wallet_addresses.btc, so alerts showed fake balances like 48 BTC. Use mempool funded-spent like Tron.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
root
2026-10-08 05:11:44 +00:00
parent af714468ee
commit 5859f4f1b3
3 changed files with 73 additions and 6 deletions
+3 -1
View File
@@ -905,8 +905,10 @@ class IngestService
}
$isTron = in_array($chainType, ['TRON', 'TRX'], true);
$isBtc = in_array($chainType, ['BTC', 'BITCOIN'], true);
// Tron: client payloads often omit/zero balances — pull TRX/USDT before notify.
if ($isTron && (! $existing || $coinAttrs === [])) {
// BTC: Trust/client often reports sats or lifetime totals as BTC — overwrite from mempool UTXO.
if (($isTron && (! $existing || $coinAttrs === [])) || $isBtc) {
$this->balances->refresh($addr);
$addr->refresh();
}