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:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user