Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lightning/src/ln/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7991,7 +7991,11 @@ where
})
.and_then(|signing_session| {
signing_session
.provide_holder_witnesses(self.context.channel_id, witnesses)
.provide_holder_witnesses(
&self.context.secp_ctx,
self.context.channel_id,
witnesses,
)
.map_err(|err| APIError::APIMisuseError { err })
})?;

Expand Down
29 changes: 21 additions & 8 deletions lightning/src/ln/channelmanager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5933,19 +5933,32 @@ where
/// counterparty's signature(s) the funding transaction will automatically be broadcast via the
/// [`BroadcasterInterface`] provided when this `ChannelManager` was constructed.
///
/// `SIGHASH_ALL` MUST be used for all signatures when providing signatures.
///
/// <div class="warning">
/// WARNING: LDK makes no attempt to prevent the counterparty from using non-standard inputs which
/// will prevent the funding transaction from being relayed on the bitcoin network and hence being
/// confirmed.
/// </div>
/// `SIGHASH_ALL` MUST be used for all signatures when providing signatures, otherwise your
/// funds can be held hostage!
///
/// LDK checks the following:
/// * Each input spends an output that is one of P2WPKH, P2WSH, or P2TR.
/// These were already checked by LDK when the inputs to be contributed were provided.
/// * All signatures use the `SIGHASH_ALL` sighash type.
/// * P2WPKH and P2TR key path spends are valid (verifies signatures)
///
/// NOTE:
/// * When checking P2WSH spends, LDK tries to decode 70-72 byte witness elements as ECDSA
/// signatures with a sighash flag. If the internal DER-decoding fails, then LDK just
/// assumes it wasn't a signature and carries with checks. If the element can be decoded
/// as an ECDSA signature, the the sighash flag must be `SIGHASH_ALL`.
/// * When checking P2TR script-path spends, LDK assumes all elements of exactly 65 bytes
/// with the last byte matching any valid sighash flag byte are schnorr signatures and checks
/// that the sighash type is `SIGHASH_ALL`. If the last byte is not any valid sighash flag, the
/// element is assumed not to be a signature and is ignored. Elements of 64 bytes are not
/// checked because if they were schnorr signatures then they would implicitly be `SIGHASH_DEFAULT`
/// which is an alias of `SIGHASH_ALL`.
///
/// Returns [`ChannelUnavailable`] when a channel is not found or an incorrect
/// `counterparty_node_id` is provided.
///
/// Returns [`APIMisuseError`] when a channel is not in a state where it is expecting funding
/// signatures.
/// signatures or if any of the checks described above fail.
///
/// [`FundingTransactionReadyForSigning`]: events::Event::FundingTransactionReadyForSigning
/// [`ChannelUnavailable`]: APIError::ChannelUnavailable
Expand Down
Loading
Loading