-
Notifications
You must be signed in to change notification settings - Fork 418
Introduce FundingTransactionReadyForSignatures
event
#3889
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
dunxen
wants to merge
6
commits into
lightningdevkit:main
Choose a base branch
from
dunxen:2025-06-readyforsigningevent
base: main
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.
+411
−65
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
89f93b9
Introduce `FundingTransactionReadyForSignatures` event
dunxen 60fb2f4
f only emit FundingTransactionReadyForSigning on initial commitment_s…
dunxen 982fd2b
Add `prev_ouput` to `NegotiatedTxInput` for SIGHASH_ALL & key-spend c…
dunxen 3ec11de
Verify the holder provided valid witnesses and uses SIGHASH_ALL
dunxen a285743
f add splicing check in funding_transaction_signed
dunxen b161cba
Use bool for `monitor_pending_tx_signatures` over `Option<TxSignatures>`
dunxen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1676,6 +1676,48 @@ pub enum Event { | |
/// [`ChannelManager::send_static_invoice`]: crate::ln::channelmanager::ChannelManager::send_static_invoice | ||
reply_path: Responder, | ||
}, | ||
/// Indicates that a channel funding transaction constructed interactively is ready to be | ||
/// signed. This event will only be triggered if at least one input was contributed. | ||
/// | ||
/// The transaction contains all inputs provided by both parties along with the channel's funding | ||
/// output and a change output if applicable. | ||
/// | ||
/// No part of the transaction should be changed before signing as the content of the transaction | ||
/// has already been negotiated with the counterparty. | ||
/// | ||
/// Each signature MUST use the `SIGHASH_ALL` flag to avoid invalidation of the initial commitment and | ||
/// hence possible loss of funds. | ||
/// | ||
/// After signing, call [`ChannelManager::funding_transaction_signed`] with the (partially) signed | ||
/// funding transaction. | ||
/// | ||
/// Generated in [`ChannelManager`] message handling. | ||
/// | ||
/// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager | ||
/// [`ChannelManager::funding_transaction_signed`]: crate::ln::channelmanager::ChannelManager::funding_transaction_signed | ||
FundingTransactionReadyForSigning { | ||
/// The channel_id of the channel which you'll need to pass back into | ||
/// [`ChannelManager::funding_transaction_signed`]. | ||
/// | ||
/// [`ChannelManager::funding_transaction_signed`]: crate::ln::channelmanager::ChannelManager::funding_transaction_signed | ||
channel_id: ChannelId, | ||
/// The counterparty's node_id, which you'll need to pass back into | ||
/// [`ChannelManager::funding_transaction_signed`]. | ||
/// | ||
/// [`ChannelManager::funding_transaction_signed`]: crate::ln::channelmanager::ChannelManager::funding_transaction_signed | ||
counterparty_node_id: PublicKey, | ||
/// The `user_channel_id` value passed in for outbound channels, or for inbound channels if | ||
/// [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise | ||
/// `user_channel_id` will be randomized for inbound channels. | ||
/// | ||
/// [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels | ||
user_channel_id: u128, | ||
/// The unsigned transaction to be signed and passed back to | ||
/// [`ChannelManager::funding_transaction_signed`]. | ||
/// | ||
/// [`ChannelManager::funding_transaction_signed`]: crate::ln::channelmanager::ChannelManager::funding_transaction_signed | ||
unsigned_transaction: Transaction, | ||
}, | ||
} | ||
|
||
impl Writeable for Event { | ||
|
@@ -2117,6 +2159,10 @@ impl Writeable for Event { | |
47u8.write(writer)?; | ||
// Never write StaticInvoiceRequested events as buffered onion messages aren't serialized. | ||
}, | ||
&Event::FundingTransactionReadyForSigning { .. } => { | ||
49u8.write(writer)?; | ||
// We never write out FundingTransactionReadyForSigning events as they will be regenerated necessary. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. when necessary* |
||
}, | ||
// Note that, going forward, all new events must only write data inside of | ||
// `write_tlv_fields`. Versions 0.0.101+ will ignore odd-numbered events that write | ||
// data via `write_tlv_fields`. | ||
|
@@ -2694,6 +2740,8 @@ impl MaybeReadable for Event { | |
// Note that we do not write a length-prefixed TLV for StaticInvoiceRequested events. | ||
#[cfg(async_payments)] | ||
47u8 => Ok(None), | ||
// Note that we do not write a length-prefixed TLV for FundingTransactionReadyForSigning events. | ||
49u8 => Ok(None), | ||
// Versions prior to 0.0.100 did not ignore odd types, instead returning InvalidValue. | ||
// Version 0.0.100 failed to properly ignore odd types, possibly resulting in corrupt | ||
// reads. | ||
|
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.