Skip to content

Fix trivial underflow/overflow issues#940

Open
benthecarman wants to merge 4 commits into
lightningdevkit:mainfrom
benthecarman:over-underflows
Open

Fix trivial underflow/overflow issues#940
benthecarman wants to merge 4 commits into
lightningdevkit:mainfrom
benthecarman:over-underflows

Conversation

@benthecarman

Copy link
Copy Markdown
Contributor

A bunch of small issues found by project-loupe. Can drop any commits that we don't think are worth it (the electrum fee one might be a bit much).

Return InvalidAmount when converting the requested satoshi amount to
millisatoshis would overflow. This keeps debug and release behavior
consistent and avoids producing a URI whose on-chain amount differs from
its Lightning payment amount.

This commit was created with assistance from OpenAI Codex.
Limit fee estimates returned by Electrum servers before they enter the
fee-rate cache, and warn when either the raw estimate or adjusted value
has to be capped. This prevents extreme server-provided values from
flowing into wallet transaction construction.

This commit was created with assistance from OpenAI Codex.
Use saturating arithmetic when accounting for skimmed JIT-channel fees
while validating manually claimed payments. This prevents an oversized
skimmed fee from underflowing the expected claimable amount.

This commit was created with assistance from OpenAI Codex.
Track registered transaction IDs in a set so repeated filter
registrations do not grow the collection or slow block-connected checks.
This keeps the wallet's registered-transaction lookup bounded by unique
transaction IDs.

This commit was created with assistance from OpenAI Codex.
@ldk-reviews-bot

ldk-reviews-bot commented Jun 12, 2026

Copy link
Copy Markdown

I've assigned @tnull as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

@ldk-reviews-bot ldk-reviews-bot requested a review from tnull June 12, 2026 20:59
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