Skip to content

fix: huf-notification-100x#433

Open
openoms wants to merge 1 commit intomainfrom
fix/huf-notification-100x
Open

fix: huf-notification-100x#433
openoms wants to merge 1 commit intomainfrom
fix/huf-notification-100x

Conversation

@openoms
Copy link

@openoms openoms commented Jan 29, 2026

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

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
Copilot AI review requested due to automatic review settings January 29, 2026 15:09
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_places and special-case handling in Currency::format_minor_units so 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_units benefit from this HUF fix without changing other currencies’ behavior.
  • Add a regression test in transaction_occurred notification tests verifying that a Lightning receipt with HUF display currency renders as 3665.19Ft instead of 366519Ft.

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 openoms marked this pull request as ready for review February 2, 2026 11:56
Copy link
Author

@openoms openoms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect 100x amount in payment notification when currency is HUF

2 participants