Skip to content

openingd: bound funding_satoshis by total bitcoin supply - #9368

Open
morehouse wants to merge 1 commit into
ElementsProject:masterfrom
morehouse:bounds_check_funding_satoshis
Open

openingd: bound funding_satoshis by total bitcoin supply#9368
morehouse wants to merge 1 commit into
ElementsProject:masterfrom
morehouse:bounds_check_funding_satoshis

Conversation

@morehouse

Copy link
Copy Markdown
Contributor

funding_satoshis values above the total bitcoin supply were not rejected during open_channel/accept_channel negotiation and would later cause libwally to fail and openingd to crash during commitment transaction construction.

Reject such funding_satoshis values immediately so that the negotiation terminates gracefully.

The new test covers the v1 funding flow by manually constructing and sending open_channel messages with excessive funding_satoshis values and then completing the funding flow through funding_created and funding_signed.

The dualopend sites are also fixed for consistency, though it's not clear whether the crash can even be reached via the v2 flow, and writing a test for the v2 flow would be significantly more complex than the v1 test.

Fixes: #9225

funding_satoshis values above the total bitcoin supply were not rejected
during open_channel/accept_channel negotiation and would later cause
libwally to fail and openingd to crash during commitment transaction
construction.

Reject such funding_satoshis values immediately so that the negotiation
terminates gracefully.

Fixes: ElementsProject#9225
Changelog-Fixed: `openingd` no longer crashes when a peer opens a channel with a `funding_satoshis` value greater than the total bitcoin supply.
@morehouse
morehouse force-pushed the bounds_check_funding_satoshis branch from dc74660 to 0fb3f26 Compare July 31, 2026 02:02
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.

openingd crashes on assertion wally_err == WALLY_OK when peer sends open_channel with funding_satoshis > WALLY_SATOSHI_MAX

1 participant