@@ -1255,6 +1255,9 @@ pub(crate) struct ShutdownResult {
1255
1255
pub(crate) unbroadcasted_funding_tx: Option<Transaction>,
1256
1256
pub(crate) channel_funding_txo: Option<OutPoint>,
1257
1257
pub(crate) last_local_balance_msat: u64,
1258
+ /// If a splice was in progress when the channel was shut down, this contains
1259
+ /// the splice funding information for emitting a SpliceFailed event.
1260
+ pub(crate) splice_funding_failed: Option<SpliceFundingFailed>,
1258
1261
}
1259
1262
1260
1263
/// Tracks the transaction number, along with current and next commitment points.
@@ -6094,6 +6097,7 @@ where
6094
6097
is_manual_broadcast: self.is_manual_broadcast,
6095
6098
channel_funding_txo: funding.get_funding_txo(),
6096
6099
last_local_balance_msat: funding.value_to_self_msat,
6100
+ splice_funding_failed: None,
6097
6101
}
6098
6102
}
6099
6103
@@ -6850,7 +6854,37 @@ where
6850
6854
}
6851
6855
6852
6856
pub fn force_shutdown(&mut self, closure_reason: ClosureReason) -> ShutdownResult {
6853
- self.context.force_shutdown(&self.funding, closure_reason)
6857
+ // Capture splice funding failed information if we have an active splice negotiation
6858
+ let splice_funding_failed = self.pending_splice.as_mut()
6859
+ .and_then(|pending_splice| pending_splice.funding_negotiation.take())
6860
+ .map(|funding_negotiation| {
6861
+ // Create SpliceFundingFailed for any active splice negotiation during shutdown
6862
+ let (funding_txo, channel_type) = match &funding_negotiation {
6863
+ FundingNegotiation::AwaitingAck { .. } => {
6864
+ (None, None)
6865
+ },
6866
+ FundingNegotiation::ConstructingTransaction { funding, .. } => {
6867
+ (funding.get_funding_txo().map(|txo| txo.into_bitcoin_outpoint()), Some(funding.get_channel_type().clone()))
6868
+ },
6869
+ FundingNegotiation::AwaitingSignatures { funding } => {
6870
+ (funding.get_funding_txo().map(|txo| txo.into_bitcoin_outpoint()), Some(funding.get_channel_type().clone()))
6871
+ },
6872
+ };
6873
+
6874
+ SpliceFundingFailed {
6875
+ channel_id: self.context.channel_id,
6876
+ counterparty_node_id: self.context.counterparty_node_id,
6877
+ user_channel_id: self.context.user_id,
6878
+ funding_txo,
6879
+ channel_type,
6880
+ contributed_inputs: Vec::new(),
6881
+ contributed_outputs: Vec::new(),
6882
+ }
6883
+ });
6884
+
6885
+ let mut shutdown_result = self.context.force_shutdown(&self.funding, closure_reason);
6886
+ shutdown_result.splice_funding_failed = splice_funding_failed;
6887
+ shutdown_result
6854
6888
}
6855
6889
6856
6890
fn interactive_tx_constructor_mut(&mut self) -> Option<&mut InteractiveTxConstructor> {
@@ -10237,6 +10271,7 @@ where
10237
10271
is_manual_broadcast: self.context.is_manual_broadcast,
10238
10272
channel_funding_txo: self.funding.get_funding_txo(),
10239
10273
last_local_balance_msat: self.funding.value_to_self_msat,
10274
+ splice_funding_failed: None,
10240
10275
}
10241
10276
}
10242
10277
0 commit comments