Skip to content

Commit 9a69609

Browse files
committed
f swap check order to make the comments line up
1 parent e39310c commit 9a69609

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

lightning/src/ln/channelmanager.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -4331,12 +4331,6 @@ where
43314331
let mut peer_state_lock = peer_state_mutex_opt.unwrap().lock().unwrap();
43324332
let peer_state = &mut *peer_state_lock;
43334333

4334-
let best_block_height = self.best_block.read().unwrap().height();
4335-
if Self::unfunded_channel_count(peer_state, best_block_height) >= MAX_UNFUNDED_CHANS_PER_PEER {
4336-
return Err(MsgHandleErrInternal::send_err_msg_no_close(
4337-
format!("Refusing more than {} unfunded channels.", MAX_UNFUNDED_CHANS_PER_PEER),
4338-
msg.temporary_channel_id.clone()));
4339-
}
43404334
// If this peer already has some channels, a new channel won't increase our number of peers
43414335
// with unfunded channels, so as long as we aren't over the maximum number of unfunded
43424336
// channels per-peer we can accept channels from a peer with existing ones.
@@ -4346,6 +4340,13 @@ where
43464340
msg.temporary_channel_id.clone()));
43474341
}
43484342

4343+
let best_block_height = self.best_block.read().unwrap().height();
4344+
if Self::unfunded_channel_count(peer_state, best_block_height) >= MAX_UNFUNDED_CHANS_PER_PEER {
4345+
return Err(MsgHandleErrInternal::send_err_msg_no_close(
4346+
format!("Refusing more than {} unfunded channels.", MAX_UNFUNDED_CHANS_PER_PEER),
4347+
msg.temporary_channel_id.clone()));
4348+
}
4349+
43494350
let mut channel = match Channel::new_from_req(&self.fee_estimator, &self.entropy_source, &self.signer_provider,
43504351
counterparty_node_id.clone(), &self.channel_type_features(), &peer_state.latest_features, msg, user_channel_id,
43514352
&self.default_configuration, best_block_height, &self.logger, outbound_scid_alias)

0 commit comments

Comments
 (0)