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