Don't panic on splice txs confirming with empty witnesses
What changed, and why it matters
This fix stops a Lightning node from crashing when a special type of channel upgrade transaction called a 'splice' confirms on the Bitcoin blockchain. Before the fix, the node would panic and shut down because it wrongly applied a safety check meant for regular outbound channels to splice transactions, where the other party may have supplied inputs. A malicious or buggy counterparty could potentially trigger this panic, causing a denial of service by crashing the victim's node.
Apply this patch promptly. Nodes running versions with splice support should upgrade to avoid a remote-triggerable crash. Monitor for any related follow-up fixes around splice transaction validation.
Security signals we found
panic in transaction confirmation path
remote-triggerable denial of service via splice funding tx
incorrect invariant applied to splice transactions
empty witness check overly broad for outbound channels
Evidence from the diff
In ChannelContext::funding_transaction_confirmed, the code previously panicked if an outbound channel’s funding transaction had empty witnesses, assuming the user had built an unsafe funding tx. This assumption is invalid for splice funding transactions, where the counterparty may add inputs. The patch introduces is_user_built_funding, which is true only for outbound channels that are not splice children, and uses that flag instead of funding.is_outbound() for the panic checks. This prevents a remote-triggered panic/denial-of-service when a splice funding tx confirms with empty witnesses.
Changed components
lightning/src/ln/channel.rsChannelContext::funding_transaction_confirmedsplice funding transaction confirmation handlingInspect captured patch +5 / −2
### lightning/src/ln/channel.rs
@@ -7013,6 +7013,9 @@ impl<SP: SignerProvider> ChannelContext<SP> {
},
};
+ let is_user_built_funding = funding.is_outbound()
+ && funding.channel_transaction_parameters.splice_parent_funding_txid.is_none();
+
// Check if the transaction is the expected funding transaction, and if it is,
// check that it pays the right amount to the right script.
if funding.funding_tx_confirmation_height == 0 {
@@ -7021,7 +7024,7 @@ impl<SP: SignerProvider> ChannelContext<SP> {
let txo_idx = funding_txo.index as usize;
if txo_idx >= tx.output.len() || tx.output[txo_idx].script_pubkey != funding.get_funding_redeemscript().to_p2wsh() ||
tx.output[txo_idx].value.to_sat() != funding.get_value_satoshis() {
- if funding.is_outbound() {
+ if is_user_built_funding {
// If we generated the funding transaction and it doesn't match what it
// should, the client is really broken and we should just panic and
// tell them off. That said, because hash collisions happen with high
@@ -7034,7 +7037,7 @@ impl<SP: SignerProvider> ChannelContext<SP> {
let err_reason = "funding tx had wrong script/value or output index";
return Err(ClosureReason::ProcessingError { err: err_reason.to_owned() });
} else {
- if funding.is_outbound() {
+ if is_user_built_funding {
if !tx.is_coinbase() {
for input in tx.input.iter() {
if input.witness.is_empty() {Why this scored 60/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.