@@ -1566,15 +1566,21 @@ pub mod pallet {
1566
1566
}
1567
1567
1568
1568
/// Returns the transaction priority for stake operations.
1569
- pub fn get_priority_staking ( coldkey : & T :: AccountId , hotkey : & T :: AccountId ) -> u64 {
1569
+ pub fn get_priority_staking (
1570
+ coldkey : & T :: AccountId ,
1571
+ hotkey : & T :: AccountId ,
1572
+ stake_amount : u64 ,
1573
+ ) -> u64 {
1570
1574
match LastColdkeyHotkeyStakeBlock :: < T > :: get ( coldkey, hotkey) {
1571
1575
Some ( last_stake_block) => {
1572
1576
let current_block_number = Self :: get_current_block_as_u64 ( ) ;
1573
1577
let default_priority = current_block_number. saturating_sub ( last_stake_block) ;
1574
1578
1575
- default_priority. saturating_add ( u32:: MAX as u64 )
1579
+ default_priority
1580
+ . saturating_add ( u32:: MAX as u64 )
1581
+ . saturating_add ( stake_amount)
1576
1582
}
1577
- None => 0 ,
1583
+ None => stake_amount ,
1578
1584
}
1579
1585
}
1580
1586
@@ -1703,8 +1709,12 @@ where
1703
1709
Pallet :: < T > :: get_priority_set_weights ( who, netuid)
1704
1710
}
1705
1711
1706
- pub fn get_priority_staking ( coldkey : & T :: AccountId , hotkey : & T :: AccountId ) -> u64 {
1707
- Pallet :: < T > :: get_priority_staking ( coldkey, hotkey)
1712
+ pub fn get_priority_staking (
1713
+ coldkey : & T :: AccountId ,
1714
+ hotkey : & T :: AccountId ,
1715
+ stake_amount : u64 ,
1716
+ ) -> u64 {
1717
+ Pallet :: < T > :: get_priority_staking ( coldkey, hotkey, stake_amount)
1708
1718
}
1709
1719
1710
1720
pub fn check_weights_min_stake ( who : & T :: AccountId , netuid : u16 ) -> bool {
@@ -1919,7 +1929,7 @@ where
1919
1929
* amount_staked,
1920
1930
false ,
1921
1931
) ,
1922
- Self :: get_priority_staking ( who, hotkey) ,
1932
+ Self :: get_priority_staking ( who, hotkey, * amount_staked ) ,
1923
1933
)
1924
1934
}
1925
1935
Some ( Call :: add_stake_limit {
@@ -1949,7 +1959,7 @@ where
1949
1959
max_amount,
1950
1960
* allow_partial,
1951
1961
) ,
1952
- Self :: get_priority_staking ( who, hotkey) ,
1962
+ Self :: get_priority_staking ( who, hotkey, * amount_staked ) ,
1953
1963
)
1954
1964
}
1955
1965
Some ( Call :: remove_stake {
@@ -1967,7 +1977,7 @@ where
1967
1977
* amount_unstaked,
1968
1978
false ,
1969
1979
) ,
1970
- Self :: get_priority_staking ( who, hotkey) ,
1980
+ Self :: get_priority_staking ( who, hotkey, * amount_unstaked ) ,
1971
1981
)
1972
1982
}
1973
1983
Some ( Call :: remove_stake_limit {
@@ -1990,7 +2000,7 @@ where
1990
2000
max_amount,
1991
2001
* allow_partial,
1992
2002
) ,
1993
- Self :: get_priority_staking ( who, hotkey) ,
2003
+ Self :: get_priority_staking ( who, hotkey, * amount_unstaked ) ,
1994
2004
)
1995
2005
}
1996
2006
Some ( Call :: move_stake {
@@ -2021,7 +2031,7 @@ where
2021
2031
None ,
2022
2032
false ,
2023
2033
) ,
2024
- Self :: get_priority_staking ( who, origin_hotkey) ,
2034
+ Self :: get_priority_staking ( who, origin_hotkey, * alpha_amount ) ,
2025
2035
)
2026
2036
}
2027
2037
Some ( Call :: transfer_stake {
@@ -2052,7 +2062,7 @@ where
2052
2062
None ,
2053
2063
true ,
2054
2064
) ,
2055
- Self :: get_priority_staking ( who, hotkey) ,
2065
+ Self :: get_priority_staking ( who, hotkey, * alpha_amount ) ,
2056
2066
)
2057
2067
}
2058
2068
Some ( Call :: swap_stake {
@@ -2082,7 +2092,7 @@ where
2082
2092
None ,
2083
2093
false ,
2084
2094
) ,
2085
- Self :: get_priority_staking ( who, hotkey) ,
2095
+ Self :: get_priority_staking ( who, hotkey, * alpha_amount ) ,
2086
2096
)
2087
2097
}
2088
2098
Some ( Call :: swap_stake_limit {
@@ -2121,7 +2131,7 @@ where
2121
2131
Some ( * allow_partial) ,
2122
2132
false ,
2123
2133
) ,
2124
- Self :: get_priority_staking ( who, hotkey) ,
2134
+ Self :: get_priority_staking ( who, hotkey, * alpha_amount ) ,
2125
2135
)
2126
2136
}
2127
2137
Some ( Call :: register { netuid, .. } | Call :: burned_register { netuid, .. } ) => {
0 commit comments