File tree Expand file tree Collapse file tree
pallets/subtensor/src/swap Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,20 +57,21 @@ impl<T: Config> Pallet<T> {
5757
5858 weight. saturating_accrue ( T :: DbWeight :: get ( ) . reads ( 2 ) ) ;
5959
60- // 7. Ensure the new hotkey is not already registered on any network, only if netuid is none
61- if netuid. is_none ( ) {
62- ensure ! (
63- !Self :: is_hotkey_registered_on_any_network( new_hotkey) ,
64- Error :: <T >:: HotKeyAlreadyRegisteredInSubNet
65- ) ;
66- }
67-
68- // 7.1. Ensure the hotkey is not registered on the network before, if netuid is provided
69- if let Some ( netuid) = netuid {
70- ensure ! (
71- !Self :: is_hotkey_registered_on_specific_network( new_hotkey, netuid) ,
72- Error :: <T >:: HotKeyAlreadyRegisteredInSubNet
73- ) ;
60+ match netuid {
61+ // 7. Ensure the hotkey is not registered on the network before, if netuid is provided
62+ Some ( netuid) => {
63+ ensure ! (
64+ !Self :: is_hotkey_registered_on_specific_network( new_hotkey, netuid) ,
65+ Error :: <T >:: HotKeyAlreadyRegisteredInSubNet
66+ ) ;
67+ }
68+ // 7.1 Ensure the new hotkey is not already registered on any network, only if netuid is none
69+ None => {
70+ ensure ! (
71+ !Self :: is_hotkey_registered_on_any_network( new_hotkey) ,
72+ Error :: <T >:: HotKeyAlreadyRegisteredInSubNet
73+ ) ;
74+ }
7475 }
7576
7677 // 8. Swap LastTxBlock
You can’t perform that action at this time.
0 commit comments