@@ -1914,13 +1914,8 @@ where
19141914 .handle_tx_complete(msg)
19151915 .map_err(|reason| self.fail_interactive_tx_negotiation(reason, logger))?,
19161916 None => {
1917- return Err((
1918- ChannelError::WarnAndDisconnect(
1919- "Received unexpected interactive transaction negotiation message"
1920- .to_owned(),
1921- ),
1922- None,
1923- ))
1917+ let err = "Received unexpected interactive transaction negotiation message";
1918+ return Err((ChannelError::WarnAndDisconnect(err.to_owned()), None));
19241919 },
19251920 };
19261921
@@ -13806,28 +13801,20 @@ where
1380613801 L::Target: Logger,
1380713802 {
1380813803 if !self.funding.is_outbound() {
13809- return Err((
13810- self,
13811- ChannelError::close("Received funding_signed for an inbound channel?".to_owned()),
13812- ));
13804+ let err = "Received funding_signed for an inbound channel?";
13805+ return Err((self, ChannelError::close(err.to_owned())));
1381313806 }
1381413807 if !matches!(self.context.channel_state, ChannelState::FundingNegotiated(_)) {
13815- return Err((
13816- self,
13817- ChannelError::close("Received funding_signed in strange state!".to_owned()),
13818- ));
13808+ let err = "Received funding_signed in strange state!";
13809+ return Err((self, ChannelError::close(err.to_owned())));
1381913810 }
13820- let mut holder_commitment_point =
13821- match self.unfunded_context.holder_commitment_point {
13822- Some(point) => point,
13823- None => return Err((
13824- self,
13825- ChannelError::close(
13826- "Received funding_signed before our first commitment point was available"
13827- .to_owned(),
13828- ),
13829- )),
13830- };
13811+ let mut holder_commitment_point = match self.unfunded_context.holder_commitment_point {
13812+ Some(point) => point,
13813+ None => {
13814+ let err = "Received funding_signed before our first commitment point was available";
13815+ return Err((self, ChannelError::close(err.to_owned())));
13816+ },
13817+ };
1383113818 self.context.assert_no_commitment_advancement(
1383213819 holder_commitment_point.next_transaction_number(),
1383313820 "funding_signed",
@@ -14117,10 +14104,8 @@ where
1411714104 L::Target: Logger,
1411814105 {
1411914106 if self.funding.is_outbound() {
14120- return Err((
14121- self,
14122- ChannelError::close("Received funding_created for an outbound channel?".to_owned()),
14123- ));
14107+ let err = "Received funding_created for an outbound channel?";
14108+ return Err((self, ChannelError::close(err.to_owned())));
1412414109 }
1412514110 if !matches!(
1412614111 self.context.channel_state, ChannelState::NegotiatingFunding(flags)
@@ -14129,24 +14114,17 @@ where
1412914114 // BOLT 2 says that if we disconnect before we send funding_signed we SHOULD NOT
1413014115 // remember the channel, so it's safe to just send an error_message here and drop the
1413114116 // channel.
14132- return Err((
14133- self,
14134- ChannelError::close(
14135- "Received funding_created after we got the channel!".to_owned(),
14136- ),
14137- ));
14117+ let err = "Received funding_created after we got the channel!";
14118+ return Err((self, ChannelError::close(err.to_owned())));
1413814119 }
14139- let mut holder_commitment_point =
14140- match self.unfunded_context.holder_commitment_point {
14141- Some(point) => point,
14142- None => return Err((
14143- self,
14144- ChannelError::close(
14145- "Received funding_created before our first commitment point was available"
14146- .to_owned(),
14147- ),
14148- )),
14149- };
14120+ let mut holder_commitment_point = match self.unfunded_context.holder_commitment_point {
14121+ Some(point) => point,
14122+ None => {
14123+ let err =
14124+ "Received funding_created before our first commitment point was available";
14125+ return Err((self, ChannelError::close(err.to_owned())));
14126+ },
14127+ };
1415014128 self.context.assert_no_commitment_advancement(
1415114129 holder_commitment_point.next_transaction_number(),
1415214130 "funding_created",
0 commit comments