Fix divisibility in invoice details of lightning amounts (#6202)

* Fix divisibility in invoice details of lightning amounts

This PR will show 11 decimal in the invoice details for BTC amount
of lightning payment methods.

It also hacks around the fact that some
lightning clients don't create the requested amount of sats, which
resulted in over or under payments. (Blink not supporting msats, and
strike)

Now, In that case, a payment method fee (which can be negative) called tweak fee
will be added to the prompt.

We are also hiding this tweak fee from the user in the checkout page in
order to not disturb the UI with inconsequential fee of 0.000000001 sats.

* Only show 8 digits in checkout, even if amount is 11 digits
This commit is contained in:
Nicolas Dorier
2024-09-12 12:43:08 +09:00
committed by GitHub
parent f3d485da53
commit b4946f4db1
11 changed files with 95 additions and 52 deletions

View File

@@ -94,6 +94,8 @@ namespace BTCPayServer.Controllers.Greenfield
public async Task<IActionResult> GetNotificationSettings()
{
var user = await _userManager.GetUserAsync(User);
if (user is null)
return NotFound();
var model = GetNotificationSettingsData(user);
return Ok(model);
}
@@ -103,6 +105,8 @@ namespace BTCPayServer.Controllers.Greenfield
public async Task<IActionResult> UpdateNotificationSettings(UpdateNotificationSettingsRequest request)
{
var user = await _userManager.GetUserAsync(User);
if (user is null)
return NotFound();
if (request.Disabled.Contains("all"))
{
user.DisabledNotifications = "all";