@@ -12864,27 +12864,27 @@ where
12864
12864
#[rustfmt::skip]
12865
12865
pub fn stfu<L: Deref>(
12866
12866
&mut self, msg: &msgs::Stfu, logger: &L
12867
- ) -> Result<Option<StfuResponse>, ChannelError> where L::Target: Logger {
12867
+ ) -> Result<Option<StfuResponse>, ( ChannelError, Option<SpliceFundingFailed>) > where L::Target: Logger {
12868
12868
if self.context.channel_state.is_quiescent() {
12869
- return Err(ChannelError::Warn("Channel is already quiescent".to_owned()));
12869
+ return Err(( ChannelError::Warn("Channel is already quiescent".to_owned()), None ));
12870
12870
}
12871
12871
if self.context.channel_state.is_remote_stfu_sent() {
12872
- return Err(ChannelError::Warn(
12872
+ return Err(( ChannelError::Warn(
12873
12873
"Peer sent `stfu` when they already sent it and we've yet to become quiescent".to_owned()
12874
- ));
12874
+ ), None) );
12875
12875
}
12876
12876
12877
12877
if !self.context.is_live() {
12878
- return Err(ChannelError::Warn(
12878
+ return Err(( ChannelError::Warn(
12879
12879
"Peer sent `stfu` when we were not in a live state".to_owned()
12880
- ));
12880
+ ), None) );
12881
12881
}
12882
12882
12883
12883
if !self.context.channel_state.is_local_stfu_sent() {
12884
12884
if !msg.initiator {
12885
- return Err(ChannelError::WarnAndDisconnect(
12885
+ return Err(( ChannelError::WarnAndDisconnect(
12886
12886
"Peer sent unexpected `stfu` without signaling as initiator".to_owned()
12887
- ));
12887
+ ), None) );
12888
12888
}
12889
12889
12890
12890
// We don't check `is_waiting_on_peer_pending_channel_update` prior to setting the flag
@@ -12898,7 +12898,7 @@ where
12898
12898
return self
12899
12899
.send_stfu(logger)
12900
12900
.map(|stfu| Some(StfuResponse::Stfu(stfu)))
12901
- .map_err(|e| ChannelError::Ignore(e.to_owned()));
12901
+ .map_err(|e| ( ChannelError::Ignore(e.to_owned()), None ));
12902
12902
}
12903
12903
12904
12904
// We already sent `stfu` and are now processing theirs. It may be in response to ours, or
@@ -12917,9 +12917,9 @@ where
12917
12917
// have a monitor update pending if we've processed a message from the counterparty, but
12918
12918
// we don't consider this when becoming quiescent since the states are not mutually
12919
12919
// exclusive.
12920
- return Err(ChannelError::WarnAndDisconnect(
12920
+ return Err(( ChannelError::WarnAndDisconnect(
12921
12921
"Received counterparty stfu while having pending counterparty updates".to_owned()
12922
- ));
12922
+ ), None) );
12923
12923
}
12924
12924
12925
12925
self.context.channel_state.clear_local_stfu_sent();
@@ -12935,14 +12935,25 @@ where
12935
12935
match self.quiescent_action.take() {
12936
12936
None => {
12937
12937
debug_assert!(false);
12938
- return Err(ChannelError::WarnAndDisconnect(
12938
+ return Err(( ChannelError::WarnAndDisconnect(
12939
12939
"Internal Error: Didn't have anything to do after reaching quiescence".to_owned()
12940
- ));
12940
+ ), None) );
12941
12941
},
12942
12942
Some(QuiescentAction::Splice(_instructions)) => {
12943
12943
return self.send_splice_init(_instructions)
12944
12944
.map(|splice_init| Some(StfuResponse::SpliceInit(splice_init)))
12945
- .map_err(|e| ChannelError::WarnAndDisconnect(e.to_owned()));
12945
+ .map_err(|e| {
12946
+ let splice_failed = SpliceFundingFailed {
12947
+ channel_id: self.context.channel_id,
12948
+ counterparty_node_id: self.context.counterparty_node_id,
12949
+ user_channel_id: self.context.user_id,
12950
+ funding_txo: None,
12951
+ channel_type: None,
12952
+ contributed_inputs: Vec::new(),
12953
+ contributed_outputs: Vec::new(),
12954
+ };
12955
+ (ChannelError::WarnAndDisconnect(e.to_owned()), Some(splice_failed))
12956
+ });
12946
12957
},
12947
12958
#[cfg(any(test, fuzzing))]
12948
12959
Some(QuiescentAction::DoNothing) => {
0 commit comments