Skip to content

Commit 3a3ba4b

Browse files
committed
Move random_bytes declaration to where it's needed.
1 parent ba2094d commit 3a3ba4b

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lightning/src/ln/channelmanager.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -5327,9 +5327,6 @@ where
53275327
return Err(MsgHandleErrInternal::send_err_msg_no_close("No inbound channels accepted".to_owned(), msg.temporary_channel_id.clone()));
53285328
}
53295329

5330-
let mut random_bytes = [0u8; 16];
5331-
random_bytes.copy_from_slice(&self.entropy_source.get_secure_random_bytes()[..16]);
5332-
53335330
// Get the number of peers with channels, but without funded ones. We don't care too much
53345331
// about peers that never open a channel, so we filter by peers that have at least one
53355332
// channel, and then limit the number of those with unfunded channels.
@@ -5388,6 +5385,8 @@ where
53885385
}
53895386

53905387
// Otherwise create the channel right now.
5388+
let mut random_bytes = [0u8; 16];
5389+
random_bytes.copy_from_slice(&self.entropy_source.get_secure_random_bytes()[..16]);
53915390
let user_channel_id = u128::from_be_bytes(random_bytes);
53925391
let mut channel = match InboundV1Channel::new(&self.fee_estimator, &self.entropy_source, &self.signer_provider,
53935392
counterparty_node_id.clone(), &self.channel_type_features(), &peer_state.latest_features, msg, user_channel_id,

0 commit comments

Comments
 (0)