@@ -12832,27 +12832,27 @@ where
12832
12832
#[rustfmt::skip]
12833
12833
pub fn stfu<L: Deref>(
12834
12834
&mut self, msg: &msgs::Stfu, logger: &L
12835
- ) -> Result<Option<StfuResponse>, ChannelError> where L::Target: Logger {
12835
+ ) -> Result<Option<StfuResponse>, ( ChannelError, Option<SpliceFundingFailed>) > where L::Target: Logger {
12836
12836
if self.context.channel_state.is_quiescent() {
12837
- return Err(ChannelError::Warn("Channel is already quiescent".to_owned()));
12837
+ return Err(( ChannelError::Warn("Channel is already quiescent".to_owned()), None ));
12838
12838
}
12839
12839
if self.context.channel_state.is_remote_stfu_sent() {
12840
- return Err(ChannelError::Warn(
12840
+ return Err(( ChannelError::Warn(
12841
12841
"Peer sent `stfu` when they already sent it and we've yet to become quiescent".to_owned()
12842
- ));
12842
+ ), None) );
12843
12843
}
12844
12844
12845
12845
if !self.context.is_live() {
12846
- return Err(ChannelError::Warn(
12846
+ return Err(( ChannelError::Warn(
12847
12847
"Peer sent `stfu` when we were not in a live state".to_owned()
12848
- ));
12848
+ ), None) );
12849
12849
}
12850
12850
12851
12851
if !self.context.channel_state.is_local_stfu_sent() {
12852
12852
if !msg.initiator {
12853
- return Err(ChannelError::WarnAndDisconnect(
12853
+ return Err(( ChannelError::WarnAndDisconnect(
12854
12854
"Peer sent unexpected `stfu` without signaling as initiator".to_owned()
12855
- ));
12855
+ ), None) );
12856
12856
}
12857
12857
12858
12858
// We don't check `is_waiting_on_peer_pending_channel_update` prior to setting the flag
@@ -12866,7 +12866,7 @@ where
12866
12866
return self
12867
12867
.send_stfu(logger)
12868
12868
.map(|stfu| Some(StfuResponse::Stfu(stfu)))
12869
- .map_err(|e| ChannelError::Ignore(e.to_owned()));
12869
+ .map_err(|e| ( ChannelError::Ignore(e.to_owned()), None ));
12870
12870
}
12871
12871
12872
12872
// We already sent `stfu` and are now processing theirs. It may be in response to ours, or
@@ -12885,9 +12885,9 @@ where
12885
12885
// have a monitor update pending if we've processed a message from the counterparty, but
12886
12886
// we don't consider this when becoming quiescent since the states are not mutually
12887
12887
// exclusive.
12888
- return Err(ChannelError::WarnAndDisconnect(
12888
+ return Err(( ChannelError::WarnAndDisconnect(
12889
12889
"Received counterparty stfu while having pending counterparty updates".to_owned()
12890
- ));
12890
+ ), None) );
12891
12891
}
12892
12892
12893
12893
self.context.channel_state.clear_local_stfu_sent();
@@ -12903,14 +12903,25 @@ where
12903
12903
match self.quiescent_action.take() {
12904
12904
None => {
12905
12905
debug_assert!(false);
12906
- return Err(ChannelError::WarnAndDisconnect(
12906
+ return Err(( ChannelError::WarnAndDisconnect(
12907
12907
"Internal Error: Didn't have anything to do after reaching quiescence".to_owned()
12908
- ));
12908
+ ), None) );
12909
12909
},
12910
12910
Some(QuiescentAction::Splice(_instructions)) => {
12911
12911
return self.send_splice_init(_instructions)
12912
12912
.map(|splice_init| Some(StfuResponse::SpliceInit(splice_init)))
12913
- .map_err(|e| ChannelError::WarnAndDisconnect(e.to_owned()));
12913
+ .map_err(|e| {
12914
+ let splice_failed = SpliceFundingFailed {
12915
+ channel_id: self.context.channel_id,
12916
+ counterparty_node_id: self.context.counterparty_node_id,
12917
+ user_channel_id: self.context.user_id,
12918
+ funding_txo: None,
12919
+ channel_type: None,
12920
+ contributed_inputs: Vec::new(),
12921
+ contributed_outputs: Vec::new(),
12922
+ };
12923
+ (ChannelError::WarnAndDisconnect(e.to_owned()), Some(splice_failed))
12924
+ });
12914
12925
},
12915
12926
#[cfg(any(test, fuzzing))]
12916
12927
Some(QuiescentAction::DoNothing) => {
0 commit comments