Skip to content

fix: round lightning invoice amounts to nearest satoshi#62

Merged
v0l merged 1 commit into
masterfrom
feat/round-lightning-invoice-amounts
Feb 22, 2026
Merged

fix: round lightning invoice amounts to nearest satoshi#62
v0l merged 1 commit into
masterfrom
feat/round-lightning-invoice-amounts

Conversation

@v0l

@v0l v0l commented Feb 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add round_to_sat() helper function to round milli-satoshi amounts up to the nearest satoshi
  • Apply rounding to VM payment and subscription payment invoice creation
  • Add unit tests for the rounding function

Some Lightning wallets don't handle milli-sats amounts correctly. This change rounds invoice amounts to whole satoshis (rounding up to avoid underpayment).

Closes #61

Some Lightning wallets don't handle milli-sats amounts correctly.
Round invoice amounts up to the nearest satoshi to ensure wallet
compatibility while avoiding underpayment issues.

The rounding is applied in two places:
1. In the pricing engine (get_amount_and_rate) for the base amount
2. At invoice creation for the final amount+tax sum

Closes #61
@v0l
v0l force-pushed the feat/round-lightning-invoice-amounts branch from bb1bbcc to 962e40d Compare February 22, 2026 18:07
@v0l
v0l merged commit b6f8a0d into master Feb 22, 2026
5 checks passed
@v0l
v0l deleted the feat/round-lightning-invoice-amounts branch February 22, 2026 19:16
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.

Round lightning invoice amounts

1 participant