File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
pallets/subtensor/src/coinbase Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -299,6 +299,25 @@ impl<T: Config> Pallet<T> {
299
299
Self :: deposit_event ( Event :: NetworkRateLimitSet ( limit) ) ;
300
300
}
301
301
302
+ /// Checks if registrations are allowed for a given subnet.
303
+ ///
304
+ /// This function retrieves the subnet hyperparameters for the specified subnet and checks the
305
+ /// `registration_allowed` flag. If the subnet doesn't exist or doesn't have hyperparameters
306
+ /// defined, it returns `false`.
307
+ ///
308
+ /// # Arguments
309
+ ///
310
+ /// * `netuid` - The unique identifier of the subnet.
311
+ ///
312
+ /// # Returns
313
+ ///
314
+ /// * `bool` - `true` if registrations are allowed for the subnet, `false` otherwise.
315
+ pub fn is_registration_allowed ( netuid : u16 ) -> bool {
316
+ Self :: get_subnet_hyperparams ( netuid)
317
+ . map ( |params| params. registration_allowed )
318
+ . unwrap_or ( false )
319
+ }
320
+
302
321
/// Computes and sets emission values for the root network which determine the emission for all subnets.
303
322
///
304
323
/// This function is responsible for calculating emission based on network weights, stake values,
You can’t perform that action at this time.
0 commit comments