Skip to content

fix: JMD currency precision — backend fixes (#282)#363

Closed
onchito-walks wants to merge 1 commit into
lnflash:mainfrom
onchito-walks:fix/jmd-currency-precision
Closed

fix: JMD currency precision — backend fixes (#282)#363
onchito-walks wants to merge 1 commit into
lnflash:mainfrom
onchito-walks:fix/jmd-currency-precision

Conversation

@onchito-walks
Copy link
Copy Markdown

Fixes the backend portion of #282. Addresses issues from earlier PR reviews (#304, #309).

Changes:

  • Math.round() instead of Math.floor() for exchange rates
  • Correct offset (12 BTC, 6 USD) instead of 0n
  • displayCurrency parameter instead of hardcoded "USD"
  • JMD conversion via ExchangeRates.jmd.sell static rate
  • Price service uses static JMD rate instead of BTC triangulation

15 new unit tests. 48/48 passing, zero regressions.

/claim #282

… static rate

Backend fixes for lnflash#282:
- Math.round() instead of Math.floor() for exchange rates
- Correct offset (12 BTC, 6 USD) instead of 0n
- displayCurrency parameter instead of hardcoded "USD"
- JMD conversion via ExchangeRates.jmd.sell static rate
- Price service uses static JMD rate instead of BTC triangulation

15 new tests covering all fix areas. 48/48 tests pass.
@onchito-walks
Copy link
Copy Markdown
Author

Hi @islandbitcoin — I noticed PR #363 was closed without comment. I'd appreciate any feedback on what was wrong with the approach or if there's a different direction you'd prefer for the JMD currency precision fixes (#282).

The implementation addressed the specific issues from the code review on PR #309 (NaN type errors, missing tests, Math.floor → Math.round), but happy to rework if there's a better way to handle this.

Thanks for your time.

@islandbitcoin
Copy link
Copy Markdown
Contributor

We closed the bounty program for now.

If you would like to contribute, please first join our Discord server.

@onchito-walks
Copy link
Copy Markdown
Author

Thanks @islandbitcoin — appreciate the direct answer. Understood on the bounty program pause.

The proto PRs (#364, #365 — float→double in price.proto) are separate from the bounty; they just fix a precision blocker regardless of bounty status. Happy to keep those open for review if useful, or close them if not.

Will join the Discord. Thanks again for the transparency.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants