@@ -12886,27 +12886,27 @@ where
12886
12886
#[rustfmt::skip]
12887
12887
pub fn stfu<L: Deref>(
12888
12888
&mut self, msg: &msgs::Stfu, logger: &L
12889
- ) -> Result<Option<StfuResponse>, ChannelError> where L::Target: Logger {
12889
+ ) -> Result<Option<StfuResponse>, ( ChannelError, Option<SpliceFundingFailed>) > where L::Target: Logger {
12890
12890
if self.context.channel_state.is_quiescent() {
12891
- return Err(ChannelError::Warn("Channel is already quiescent".to_owned()));
12891
+ return Err(( ChannelError::Warn("Channel is already quiescent".to_owned()), None ));
12892
12892
}
12893
12893
if self.context.channel_state.is_remote_stfu_sent() {
12894
- return Err(ChannelError::Warn(
12894
+ return Err(( ChannelError::Warn(
12895
12895
"Peer sent `stfu` when they already sent it and we've yet to become quiescent".to_owned()
12896
- ));
12896
+ ), None) );
12897
12897
}
12898
12898
12899
12899
if !self.context.is_live() {
12900
- return Err(ChannelError::Warn(
12900
+ return Err(( ChannelError::Warn(
12901
12901
"Peer sent `stfu` when we were not in a live state".to_owned()
12902
- ));
12902
+ ), None) );
12903
12903
}
12904
12904
12905
12905
if !self.context.channel_state.is_local_stfu_sent() {
12906
12906
if !msg.initiator {
12907
- return Err(ChannelError::WarnAndDisconnect(
12907
+ return Err(( ChannelError::WarnAndDisconnect(
12908
12908
"Peer sent unexpected `stfu` without signaling as initiator".to_owned()
12909
- ));
12909
+ ), None) );
12910
12910
}
12911
12911
12912
12912
// We don't check `is_waiting_on_peer_pending_channel_update` prior to setting the flag
@@ -12920,7 +12920,7 @@ where
12920
12920
return self
12921
12921
.send_stfu(logger)
12922
12922
.map(|stfu| Some(StfuResponse::Stfu(stfu)))
12923
- .map_err(|e| ChannelError::Ignore(e.to_owned()));
12923
+ .map_err(|e| ( ChannelError::Ignore(e.to_owned()), None ));
12924
12924
}
12925
12925
12926
12926
// We already sent `stfu` and are now processing theirs. It may be in response to ours, or
@@ -12939,9 +12939,9 @@ where
12939
12939
// have a monitor update pending if we've processed a message from the counterparty, but
12940
12940
// we don't consider this when becoming quiescent since the states are not mutually
12941
12941
// exclusive.
12942
- return Err(ChannelError::WarnAndDisconnect(
12942
+ return Err(( ChannelError::WarnAndDisconnect(
12943
12943
"Received counterparty stfu while having pending counterparty updates".to_owned()
12944
- ));
12944
+ ), None) );
12945
12945
}
12946
12946
12947
12947
self.context.channel_state.clear_local_stfu_sent();
@@ -12957,14 +12957,25 @@ where
12957
12957
match self.quiescent_action.take() {
12958
12958
None => {
12959
12959
debug_assert!(false);
12960
- return Err(ChannelError::WarnAndDisconnect(
12960
+ return Err(( ChannelError::WarnAndDisconnect(
12961
12961
"Internal Error: Didn't have anything to do after reaching quiescence".to_owned()
12962
- ));
12962
+ ), None) );
12963
12963
},
12964
12964
Some(QuiescentAction::Splice(_instructions)) => {
12965
12965
return self.send_splice_init(_instructions)
12966
12966
.map(|splice_init| Some(StfuResponse::SpliceInit(splice_init)))
12967
- .map_err(|e| ChannelError::WarnAndDisconnect(e.to_owned()));
12967
+ .map_err(|e| {
12968
+ let splice_failed = SpliceFundingFailed {
12969
+ channel_id: self.context.channel_id,
12970
+ counterparty_node_id: self.context.counterparty_node_id,
12971
+ user_channel_id: self.context.user_id,
12972
+ funding_txo: None,
12973
+ channel_type: None,
12974
+ contributed_inputs: Vec::new(),
12975
+ contributed_outputs: Vec::new(),
12976
+ };
12977
+ (ChannelError::WarnAndDisconnect(e.to_owned()), Some(splice_failed))
12978
+ });
12968
12979
},
12969
12980
#[cfg(any(test, fuzzing))]
12970
12981
Some(QuiescentAction::DoNothing) => {
0 commit comments