question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug]: BTCPay invoice not settling after successful Lightning payment (CLN + Lightning Charge)

See original GitHub issue

What is your BTCPay version?

BTCPay v1.6.11.0-altcoins

How did you deploy BTCPay Server?

BTCPayServer is deployed via Docker containers managed by systemd services (BTCPay, NBX, Postgres 13). Using the official upstream images. The CLN node and Lightning Charge are running on a separate machine. Lightning Charge’s HTTP port is port-forwarded to the BTCPay box over an SSH tunnel. An Nginx reverse proxy is running on the BTCPay box (localhost:8080) and forwarding traffic to Charge.

What happened?

A BTCPay invoice expired after an hour because BTCPay did not recognize a completed Lightning payment. The LN invoice was paid after 10 minutes. Both CLN and Lighting Charge have recognized the payment.

How did you encounter this bug?

A customer emailed us that their BTCPay Checkout window was still showing a Pending invoice, even though they had paid the LN invoice, which was confirmed directly on the CLN node and Lightning Charge.

Relevant log output

2022-11-24T00:23:47.152412857Z info: PayServer:      BTC (Lightning): Start listening http://localhost:8080/
2022-11-24T00:32:21.042887068Z fail: PayServer:      BTC (Lightning): Error while contacting http://localhost:8080/
2022-11-24T00:32:21.042923138Z System.FormatException: Input string was not in a correct format.
2022-11-24T00:32:21.043852325Z    at System.Number.ThrowOverflowOrFormatException(ParsingStatus status, TypeCode type)
2022-11-24T00:32:21.043866297Z    at BTCPayServer.Lightning.JsonConverters.LightMoneyJsonConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
2022-11-24T00:32:21.044269030Z    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
2022-11-24T00:32:21.044523238Z    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
2022-11-24T00:32:21.044533232Z    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
2022-11-24T00:32:21.044776997Z    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
2022-11-24T00:32:21.045027259Z    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
2022-11-24T00:32:21.045323960Z    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
2022-11-24T00:32:21.045334254Z    at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
2022-11-24T00:32:21.045611706Z    at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
2022-11-24T00:32:21.045621211Z    at BTCPayServer.Lightning.Charge.ChargeSession.WaitInvoice(CancellationToken cancellation)
2022-11-24T00:32:21.045756052Z    at BTCPayServer.Lightning.Charge.ChargeSession.BTCPayServer.Lightning.ILightningInvoiceListener.WaitInvoice(CancellationToken token)
2022-11-24T00:32:21.045763997Z    at BTCPayServer.Payments.Lightning.LightningInstanceListener.Listen(CancellationToken cancellation) in /source/BTCPayServer/Payments/Lightning/LightningListener.cs:line 473
2022-11-24T00:32:21.046617331Z info: PayServer:      BTC (Lightning): Stop listening http://localhost:8080/

What browser do you use?

Firefox 107.0

Additional information

screenshot

Are you sure this is a bug report?

  • I confirm this is a bug report

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
nitramizcommented, Dec 2, 2022

Hi! It was a one-time failure. It was a slightly larger payment but nothing crazy (0.02714143 BTC).

Latest Lightning Charge CLN 0.12.1

0reactions
dennisreimanncommented, Dec 21, 2022

As discussed on Mattermost, this is a conversion problem for float values in our Lightning library.

The JSON from Charge looks like this:

  {
    "msatoshi": "3187032000",
    "msatoshi_received": "3187032000.0"
  },

Fixed here: btcpayserver/BTCPayServer.Lightning#114

Read more comments on GitHub >

github_iconTop Results From Across the Web

Btcpayserver Lightning network invoice has been paid fully ...
Your environment Version of BTCPay Server: lastest Deployment method: manual ... Go to App > Create Invoice > Pay with lightning network.
Read more >
Frequently Asked Questions and Common Issues
General, non-technical questions about BTCPay. What it is, how it works, what are its features, why is it different and who can use...
Read more >
Lightning Network FAQ
Lightning Network FAQ. This document clarifies some of the most common questions and issues users face with the Lightning Network in BTCPay.
Read more >
Troubleshooting an issue in BTCPay Server
2 - Lightning Network Core Lightning (CLN) - Docker. sudo su -. docker ps. Find the Core Lightning (CLN) container ID. docker logs...
Read more >
Stores FAQ | BTCPay Server
Note this only applies to on-chain payments. Invoices paid via the Lightning Network immediately go to a settled state, as their confirmation is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found