Conversation
HUF (Hungarian Forint) has ISO 4217 exponent 0, meaning the currency officially has no minor units. However, the system internally tracks HUF amounts in fillér (1/100 HUF) for precision. This caused push notifications to display amounts 100x larger than intended. For example, 366519 fillér was displayed as "366,519Ft" instead of "3665.19Ft" as shown correctly in transaction history. The fix adds special handling in format_minor_units() for currencies like HUF that have exponent 0 but where the system uses internal decimal places. When formatting HUF, we now manually divide by 100 to convert from fillér to Forints with 2 decimal places. Fixes blinkbitcoin/blink-mobile#3234
There was a problem hiding this comment.
Pull request overview
This PR fixes incorrect HUF display in push notifications by accounting for the system’s use of fillér (1/100 HUF) while ISO 4217 defines HUF with exponent 0. It centralizes the special handling in the currency formatting primitive and adds a regression test at the notification layer.
Changes:
- Add
Currency::uses_internal_decimal_placesand special-case handling inCurrency::format_minor_unitsso that HUF values (tracked in fillér) are divided by 100 and rendered with two decimal places. - Ensure both transaction and price notifications using
format_minor_unitsbenefit from this HUF fix without changing other currencies’ behavior. - Add a regression test in
transaction_occurrednotification tests verifying that a Lightning receipt with HUF display currency renders as3665.19Ftinstead of366519Ft.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| core/notifications/src/primitives.rs | Adds uses_internal_decimal_places and a guarded early-return branch in format_minor_units to correctly format HUF (and future similar currencies) from internal minor units to human-readable form. |
| core/notifications/src/notification_event/transaction_occurred.rs | Extends tests with a HUF regression case to assert the fixed formatting in localized push notification bodies. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
openoms
left a comment
There was a problem hiding this comment.
PR Review Summary
This PR fixes incorrect HUF display in push notifications by accounting for the system's use of filler (1/100 HUF) while ISO 4217 defines HUF with exponent 0.
Code Analysis
Scope: The change only affects HUF currency. The uses_internal_decimal_places() function explicitly matches only "HUF", so no other currencies are impacted.
Logic: The fix correctly handles the filler to Forint conversion by dividing by 100 and formatting with 2 decimal places when the currency has exponent 0 but uses internal decimal places.
Regression Test: Includes huf_display_currency_formats_correctly() test verifying that 366519 filler displays as "3665.19Ft" instead of "366519Ft".
CI Status
All 28 checks passed:
- execute via bats (E2E tests): success
- execute via buck2: success
- build and test core: success
- CodeQL: no new alerts
- GraphQL Inspector: 0 breaking changes, 0 dangerous changes, 0 safe changes
Conclusion
The fix is well-scoped, correctly implemented, and properly tested. Safe to merge.
Reviewed by: Augment (Opus 4.5)
HUF (Hungarian Forint) has ISO 4217 exponent 0, meaning the currency officially has no minor units. However, the system internally tracks HUF amounts in fillér (1/100 HUF) for precision. This caused push notifications to display amounts 100x larger than intended.
For example, 366519 fillér was displayed as "366,519Ft" instead of "3665.19Ft" as shown correctly in transaction history.
The fix adds special handling in format_minor_units() for currencies like HUF that have exponent 0 but where the system uses internal decimal places. When formatting HUF, we now manually divide by 100 to convert from fillér to Forints with 2 decimal places.
Fixes blinkbitcoin/blink-mobile#3234