-
Notifications
You must be signed in to change notification settings - Fork 955
Funding transaction withholding support #8546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rustyrussell
wants to merge
15
commits into
ElementsProject:master
Choose a base branch
from
rustyrussell:guilt/withhold
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This can definitely happen with zeroconf and the about-to-be-implemented withheld=True: ``` lightningd-1 2025-09-12T13:17:50.848Z **BROKEN** 022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-chan#1: Illegal gossip state transition: CGOSSIP_WAITING_FOR_SCID->CGOSSIP_CHANNEL_UNANNOUNCED_DYING ``` Signed-off-by: Rusty Russell <[email protected]>
Signed-off-by: Rusty Russell <[email protected]>
Interestingly, @niftynei added a funding_psbt column to the db in 2020, but we don't use it (it was removed early 2021 with the "inflight" architecture). So we don't need to add a new column, just plumb it back in. Signed-off-by: Rusty Russell <[email protected]>
Signed-off-by: Rusty Russell <[email protected]>
Signed-off-by: Rusty Russell <[email protected]> Changelog-Fixed: Protocol: we now re-transmit unseen funding transactions on startup, for more robustness.
…e sendpsbt. Signed-off-by: Rusty Russell <[email protected]>
Changelog-Added: JSON-RPC: `psbt` field in `funding` in listpeerchannels, and `funding_psbt` in listclosedchannels. Signed-off-by: Rusty Russell <[email protected]>
…re-send. This covers the other corner case, where we crash before actually signing and sending the PSBT. We can spot this because the channel is in AWAITING_LOCKIN and we have a PSBT, but it's not signed yet. Signed-off-by: Rusty Russell <[email protected]>
Normally we don't care, but if we're withholding it, keep it around so we can sign & broadcast later. Signed-off-by: Rusty Russell <[email protected]>
…els. Signed-off-by: Rusty Russell <[email protected]> Changelog-Added: JSON-RPC: `listpeerchannels` `funding` object `withheld` flag, and `listclosedchannels` `funding_withheld` flags, indicating fundchannel_complete was called with the `withheld` parameter true.
…ithheld channel. There's no funding tx to spend. Signed-off-by: Rusty Russell <[email protected]>
…art. Signed-off-by: Rusty Russell <[email protected]>
This is just a polite way of telling us that if we close, don't bother broadcasting since we didn't broadcast the funding tx. Changelog-Added: JSON-RPC: `fundchannel_complete` new parameter `withhold` (default false). Signed-off-by: Rusty Russell <[email protected]>
Signed-off-by: Rusty Russell <[email protected]>
Signed-off-by: Rusty Russell <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is useful for implementing an LSP, where you want to open a zero conf channel, and only broadcast the actual funding tx once they've sent enough to make it worthwhile.
The first few patches actually fix an unrelated bug I realized when looking at this: if we crash, nothing broadcasts the funding transactions again. If bitcoind doesn't keep it, or if it didn't make it to bitcoind, the transaction will never reach the blockchain.
The flow is: