mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 16:21:02 +00:00
Improve is_member and is_runner. (#4356)
This commit is contained in:
@@ -492,14 +492,14 @@ impl<T: Trait> Module<T> {
|
||||
///
|
||||
/// Limited number of members. Binary search. Constant time factor. O(1)
|
||||
fn is_member(who: &T::AccountId) -> bool {
|
||||
Self::members_ids().binary_search(who).is_ok()
|
||||
Self::members().binary_search_by(|(a, _b)| a.cmp(who)).is_ok()
|
||||
}
|
||||
|
||||
/// Check if `who` is currently an active runner.
|
||||
///
|
||||
/// Limited number of runners-up. Binary search. Constant time factor. O(1)
|
||||
fn is_runner(who: &T::AccountId) -> bool {
|
||||
Self::runners_up_ids().binary_search(who).is_ok()
|
||||
Self::runners_up().binary_search_by(|(a, _b)| a.cmp(who)).is_ok()
|
||||
}
|
||||
|
||||
/// Returns number of desired members.
|
||||
|
||||
Reference in New Issue
Block a user