You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] JMD currency precision loss — users lose up to J$1.10 per transaction due to float truncation in convertMoneyAmount() #555
convertMoneyAmount() in app/hooks/use-price-conversion.ts (lines 74-81) only applies Math.round() for BTC amounts, not for USD/DisplayCurrency. When sats are reconverted to JMD, fractional results get truncated instead of rounded.
Additional Findings
Balance proof: After multiple J$7 sends, receiver balance was J$24.99 instead of expected J$25.00
Bug 2 also confirmed: Transaction list reconverts amounts at current price, masking historical discrepancies — only the balance reveals the precision leak
Worst case observed:J$1.10 lost on a single J$1,234.56 transaction (0.09%)
The bug is rate-timing dependent — manifests whenever sats↔JMD conversion produces a fractional result
Fix
Add Math.round() to the fiat conversion path in convertMoneyAmount(), matching the existing BTC path.
changed the title [-][Bug] Systemic JMD currency precision failures — float amounts, wrong tx history, 100× inflation, hardcoded USD[/-][+][Bug] JMD currency precision loss — users lose up to J$1.10 per transaction due to float truncation in convertMoneyAmount()[/+]on Feb 26, 2026
A JMD user sees two completely different amounts for the same transaction:
View
Amount
Currency
Transaction list
J$1,240.08
JMD (user display currency)
Transaction detail
$8.01
USD (raw settlement amount)
The user taps a J$1,240 transaction and sees $8.01 — no explanation, no JMD equivalent shown.
Root Cause
Two issues in app/components/transaction-item/TxItem.tsx (lines 54-65):
List view reconverts at current BTC price via moneyAmountToDisplayCurrencyString() instead of using tx.settlementDisplayAmount (the historical display amount set at settlement time)
Detail screen (transaction-detail-screen.tsx) shows raw settlementAmount in USD without converting to the user's display currency
Impact
JMD users see inconsistent amounts between list and detail views
List amounts drift over time as BTC price changes — a J$1,234 transaction today might show as J$1,250 tomorrow
Detail screen shows USD with no JMD context, confusing for Jamaican users
Fix
TxItem.tsx: Use tx.settlementDisplayAmount + tx.settlementDisplayCurrency for the primary amount instead of reconverting via current price
transaction-detail-screen.tsx: Convert header amount to user's display currency
5a. Wrong transaction labels: All transactions labeled "Sent USD" / "Received USD" even though the user's display currency is JMD. Should say "Sent" or "Sent JMD".
5b. Detail screen shows raw USD: Tapping a transaction that shows J$1,237 in the list opens a detail view showing $8.01 USD — the raw Ibex settlement amount with zero JMD context. Completely confusing for Jamaican users.
5c. List amounts reconvert at current BTC price: The tx list shows J$1,237.09 now, but the original send was J$1,234.56. The amount drifts as BTC/JMD price changes because TxItem.tsx reconverts sats → JMD at the current rate instead of using the historical settlementDisplayAmount.
Math.floor(trx.exchangeRateCurrencySats) — truncates fractional sat prices to 0
settlementDisplayAmount: \${trx.amount}`` — raw Ibex USD amount, never converted to JMD
Mobile (TxItem.tsx lines 54-65):
Reconverts at current BTC price via moneyAmountToDisplayCurrencyString() instead of using tx.settlementDisplayAmount
Mobile (transaction-detail-screen.tsx):
Shows raw settlementAmount in USD without converting to user's display currency
Fix
Backend: Pass account displayCurrency into the adaptor, use correct offset, use Math.round not Math.floor, convert settlementDisplayAmount to user's currency
Mobile TxItem: Use tx.settlementDisplayAmount + tx.settlementDisplayCurrency for primary amount
Mobile detail screen: Convert header amount to user's display currency
🔍 Bug 4 & Bug 7: Confirmed via code review (not visually reproducible with test setup)
Bug 4: BtcWallet.balance returns object instead of number
File:src/graphql/shared/types/object/btc-wallet.ts line 53
// BtcWallet — BROKEN: returns USDAmount class instancereturnbalanceSats// ← raw object, serializes as {} in GraphQL// UsdWallet — CORRECT: extracts numeric valuereturnNumber(balance.asCents(8))
BTC wallet enabled on forgetest1 (iOS) — shows ₿0, which masks the bug since {} and 0 both display as zero. Would need a funded BTC wallet to demonstrate. The FractionalCentAmount scalar has no serialize method, so a non-zero USDAmount object would serialize as {} or throw.
Bug 7: Breez SDK hardcodes USD display currency
File:app/hooks/useBreezPayments.ts line 48
settlementDisplayCurrency: "USD",// ← hardcoded, ignores user display currency
All Breez-settled transactions (non-custodial Lightning via BTC wallet) will show USD regardless of user's JMD setting. Cannot reproduce without funding the BTC wallet and making a Breez payment.
Status
Both bugs are confirmed in code but require funded BTC wallets / Breez transactions to demonstrate visually. The fix for both is straightforward:
closing as a duplicate/overlap of #547. consolidating jmd precision and currency-conversion work into the parent tracker there so the bug is tracked in one place.
Activity
linear commentedon Feb 22, 2026
ENG-133
islandbitcoin commentedon Feb 22, 2026
Companion backend issue: lnflash/flash#282
forge0x commentedon Feb 26, 2026
🐛 Bug 1 Reproduced:
convertMoneyAmount()Float Precision Loss📹 Video Evidence
Side-by-side production recording (iOS sender + Android receiver)
Setup
Results
Root Cause
convertMoneyAmount()inapp/hooks/use-price-conversion.ts(lines 74-81) only appliesMath.round()for BTC amounts, not for USD/DisplayCurrency. When sats are reconverted to JMD, fractional results get truncated instead of rounded.Additional Findings
Fix
Add
Math.round()to the fiat conversion path inconvertMoneyAmount(), matching the existing BTC path.[-][Bug] Systemic JMD currency precision failures — float amounts, wrong tx history, 100× inflation, hardcoded USD[/-][+][Bug] JMD currency precision loss — users lose up to J$1.10 per transaction due to float truncation in convertMoneyAmount()[/+]forge0x commentedon Feb 26, 2026
🐛 Bug 2 Reproduced: Transaction detail screen ignores display currency
📹 Video Evidence
Transaction list → detail discrepancy (Android, JMD user)
The Bug
A JMD user sees two completely different amounts for the same transaction:
The user taps a J$1,240 transaction and sees $8.01 — no explanation, no JMD equivalent shown.
Root Cause
Two issues in
app/components/transaction-item/TxItem.tsx(lines 54-65):moneyAmountToDisplayCurrencyString()instead of usingtx.settlementDisplayAmount(the historical display amount set at settlement time)transaction-detail-screen.tsx) shows rawsettlementAmountin USD without converting to the user's display currencyImpact
Fix
tx.settlementDisplayAmount+tx.settlementDisplayCurrencyfor the primary amount instead of reconverting via current priceforge0x commentedon Feb 26, 2026
🐛 Bug 5 Reproduced: Transaction labels say "USD" + detail screen shows raw USD for JMD users
📹 Video Evidence
Side-by-side iOS + Android recording
The Bug (3 issues in one)
5a. Wrong transaction labels: All transactions labeled "Sent USD" / "Received USD" even though the user's display currency is JMD. Should say "Sent" or "Sent JMD".
5b. Detail screen shows raw USD: Tapping a transaction that shows J$1,237 in the list opens a detail view showing $8.01 USD — the raw Ibex settlement amount with zero JMD context. Completely confusing for Jamaican users.
5c. List amounts reconvert at current BTC price: The tx list shows J$1,237.09 now, but the original send was J$1,234.56. The amount drifts as BTC/JMD price changes because
TxItem.tsxreconvertssats → JMDat the current rate instead of using the historicalsettlementDisplayAmount.Root Cause
Backend (
get-transactions-for-wallet.tslines ~37-50):displayCurrency: "USD"hardcoded — backend stamps every tx as USD regardless of user settingoffset: 0n— price scaling completely broken (should beSAT_PRICE_PRECISION_OFFSET = 12)Math.floor(trx.exchangeRateCurrencySats)— truncates fractional sat prices to 0settlementDisplayAmount: \${trx.amount}`` — raw Ibex USD amount, never converted to JMDMobile (
TxItem.tsxlines 54-65):moneyAmountToDisplayCurrencyString()instead of usingtx.settlementDisplayAmountMobile (
transaction-detail-screen.tsx):settlementAmountin USD without converting to user's display currencyFix
displayCurrencyinto the adaptor, use correct offset, useMath.roundnotMath.floor, convertsettlementDisplayAmountto user's currencytx.settlementDisplayAmount+tx.settlementDisplayCurrencyfor primary amountforge0x commentedon Feb 26, 2026
🔍 Bug 4 & Bug 7: Confirmed via code review (not visually reproducible with test setup)
Bug 4: BtcWallet.balance returns object instead of number
File:
src/graphql/shared/types/object/btc-wallet.tsline 53BTC wallet enabled on forgetest1 (iOS) — shows ₿0, which masks the bug since
{}and0both display as zero. Would need a funded BTC wallet to demonstrate. TheFractionalCentAmountscalar has noserializemethod, so a non-zeroUSDAmountobject would serialize as{}or throw.Bug 7: Breez SDK hardcodes USD display currency
File:
app/hooks/useBreezPayments.tsline 48All Breez-settled transactions (non-custodial Lightning via BTC wallet) will show USD regardless of user's JMD setting. Cannot reproduce without funding the BTC wallet and making a Breez payment.
Status
Both bugs are confirmed in code but require funded BTC wallets / Breez transactions to demonstrate visually. The fix for both is straightforward:
return Number(balanceSats.asCents(8))(match UsdWallet pattern)displayCurrencyfrom user's account settings instead of hardcoded"USD"forge0x commentedon Feb 26, 2026
Bug 7 — Breez SDK transactions show USD instead of JMD (video evidence)
Video: bug7-ios.mp4
What the video shows
Root cause
useBreezPayments.tsline 48 hardcodes:settlementDisplayCurrency: "USD"Should use the user's display currency preference instead.
Expected behavior
Transaction detail should show ~J$500 JMD (matching the home screen display), not $3.21 USD.
forge0x commentedon Apr 17, 2026
closing as a duplicate/overlap of #547. consolidating jmd precision and currency-conversion work into the parent tracker there so the bug is tracked in one place.