Skip to content

Commit 11aba9c

Browse files
committed
add validation for last lock to reg_network
1 parent 9e22239 commit 11aba9c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pallets/subtensor/src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2365,6 +2365,12 @@ where
23652365
Ok((validity, Some(who.clone()), origin))
23662366
}
23672367
Some(Call::register_network { .. }) => {
2368+
let current_block = Self::get_current_block_as_u64();
2369+
let last_lock_block = Self::get_network_last_lock_block();
2370+
if current_block.saturating_sub(last_lock_block) >= NetworkRateLimit::<T>::get() {
2371+
return Err(CustomTransactionError::RateLimitExceeded.into());
2372+
}
2373+
23682374
let validity = Self::validity_ok(Self::get_priority_vanilla());
23692375
Ok((validity, Some(who.clone()), origin))
23702376
}

0 commit comments

Comments
 (0)