@@ -10831,26 +10831,17 @@ where
10831
10831
ES::Target: EntropySource,
10832
10832
L::Target: Logger,
10833
10833
{
10834
- let pending_splice = if let Some(ref mut pending_splice) = &mut self.pending_splice {
10835
- pending_splice
10836
- } else {
10837
- return Err(ChannelError::Ignore(format!("Channel is not in pending splice")));
10838
- };
10839
-
10840
10834
// TODO(splicing): Add check that we are the splice (quiescence) initiator
10841
10835
10842
- let funding_negotiation_context = match pending_splice.funding_negotiation.take() {
10836
+ let funding_negotiation_context = match &self
10837
+ .pending_splice
10838
+ .as_ref()
10839
+ .ok_or(ChannelError::Ignore(format!("Channel is not in pending splice")))?
10840
+ .funding_negotiation
10841
+ {
10843
10842
Some(FundingNegotiation::AwaitingAck(context)) => context,
10844
- Some(FundingNegotiation::ConstructingTransaction(funding, constructor)) => {
10845
- pending_splice.funding_negotiation =
10846
- Some(FundingNegotiation::ConstructingTransaction(funding, constructor));
10847
- return Err(ChannelError::WarnAndDisconnect(format!(
10848
- "Got unexpected splice_ack; splice negotiation already in progress"
10849
- )));
10850
- },
10851
- Some(FundingNegotiation::AwaitingSignatures(funding)) => {
10852
- pending_splice.funding_negotiation =
10853
- Some(FundingNegotiation::AwaitingSignatures(funding));
10843
+ Some(FundingNegotiation::ConstructingTransaction(_, _))
10844
+ | Some(FundingNegotiation::AwaitingSignatures(_)) => {
10854
10845
return Err(ChannelError::WarnAndDisconnect(format!(
10855
10846
"Got unexpected splice_ack; splice negotiation already in progress"
10856
10847
)));
@@ -10885,6 +10876,17 @@ where
10885
10876
self.funding.get_value_satoshis(),
10886
10877
);
10887
10878
10879
+ let pending_splice =
10880
+ self.pending_splice.as_mut().expect("We should have returned an error earlier!");
10881
+ // TODO: Good candidate for a let else statement once MSRV >= 1.65
10882
+ let funding_negotiation_context = if let Some(FundingNegotiation::AwaitingAck(context)) =
10883
+ pending_splice.funding_negotiation.take()
10884
+ {
10885
+ context
10886
+ } else {
10887
+ panic!("We should have returned an error earlier!");
10888
+ };
10889
+
10888
10890
let mut interactive_tx_constructor = funding_negotiation_context
10889
10891
.into_interactive_tx_constructor(
10890
10892
&self.context,
0 commit comments