Lightning developers patch LND bug that could erase settled payment records

3 min read
Lightning developers patch LND bug that could erase settled payment records
PrimeXBT Editorial Team
Reviewed by PrimeXBT

Topics in article

Lightning developers patched a bug in LND that could make a node lose track of settled payments after a restart. A counter overflow at 65,536 entries caused the flaw, and developers found a way peers could trigger it. The project's disclosures identify no confirmed exploitation or financial losses.

Developers patched a vulnerability that could cause nodes to lose track of settled payments after a restart. The flaw affected LND, a widely used implementation of the Lightning Network, which lets users send Bitcoin through payment channels without recording every transaction directly on the blockchain.

The team released v0.21.8-beta and v0.20.8-beta on Nov. 11 to fix an error in how the software saved and restored channel updates. Without the fix, a node could rebuild incomplete payment records after restarting, even when the original information remained on its disk.

A 16-bit counter wraps to zero

According to LND maintainer Olaoluwa Osuntokun, known as Roasbeef, the problem involved a counter tracking acknowledged updates from a connected peer. The software stored the number of entries as a 16-bit unsigned integer, which holds values only up to 65,535.

Once the list reached 65,536 entries, the counter reset to zero, even though LND kept writing the updates to storage. After a restart, the node could read that zero as an empty list and omit a previously settled hashed timelock contract (HTLC), a conditional payment mechanism that helps secure transactions across Lightning channels.

Peers could push the list toward its limit

The risk grew when developers found a way for connected peers to fill the list. LND collaborator ziggie1984 explained in the GitHub discussion that a peer could repeatedly send fee updates and commitment signatures while withholding a required revocation message, so the pending list kept growing.

The developer reproduced the behavior in a unit test, generating 201 stored updates after 200 rounds of messages. The accumulated entries survived reconnects, which suggests that disconnecting and reconnecting would not necessarily stop the list from reaching the overflow threshold.

How the fix works

The patch adds checks that stop oversized update lists from advancing the channel state or being written to storage. It also changes how LND reads existing records, so nodes can recover complete lists saved by older versions when the data passes validation.

The fix was merged into LND's main development branch on Nov. 5 before it shipped in both November releases. Whether any live nodes hit the bug before the patch remains unknown.

Source: CryptoSlate

Trading involves risk.

Author

PrimeXBT
Our Editorial Team consists of leading experts with a proven record in the fields of trading, cryptocurrencies, blockchain and finance. We thoroughly research the sources of information in order to provide readers with quality content that serves edu...
Read author’s articles
Alert Triangle Risk Disclaimer
Disclaimer: Some past publications may be outdated. We recommend following our news to stay up to date with the latest information. For any questions, feel free to contact our support team via the chat below.
The content provided here is for informational purposes only. It is not intended as personal investment advice and does not constitute a solicitation or invitation to engage in any financial transactions, investments, or related activities. Past performance is not a reliable indicator of future results.
The financial products offered by the Company are complex and come with a high risk of losing money rapidly due to leverage. These products may not be suitable for all investors. Before engaging, you should consider whether you understand how these leveraged products work and whether you can afford the high risk of losing your money.
The Company does not accept clients from the Restricted Jurisdictions as indicated in our website/ T&C. Some services or products may not be available in your jurisdiction.
The applicable legal entity and its respective products and services depend on the client’s country of residence and the entity with which the client has established a contractual relationship during registration.

Today in markets

Browse Crypto News

Register Now

Trading involves risk

Get started in minutes

Our clients love how fast and simple our sign-up is. It takes just a few minutes to get started!

Get Started Get Started
Get started in minutes

Need Help?

Risk Warning:
Trading in leveraged products carries a high level of risk and may not be suitable for all investors.