@@ -1601,15 +1601,21 @@ pub mod pallet {
1601
1601
}
1602
1602
1603
1603
/// Returns the transaction priority for stake operations.
1604
- pub fn get_priority_staking ( coldkey : & T :: AccountId , hotkey : & T :: AccountId ) -> u64 {
1604
+ pub fn get_priority_staking (
1605
+ coldkey : & T :: AccountId ,
1606
+ hotkey : & T :: AccountId ,
1607
+ stake_amount : u64 ,
1608
+ ) -> u64 {
1605
1609
match LastColdkeyHotkeyStakeBlock :: < T > :: get ( coldkey, hotkey) {
1606
1610
Some ( last_stake_block) => {
1607
1611
let current_block_number = Self :: get_current_block_as_u64 ( ) ;
1608
1612
let default_priority = current_block_number. saturating_sub ( last_stake_block) ;
1609
1613
1610
- default_priority. saturating_add ( u32:: MAX as u64 )
1614
+ default_priority
1615
+ . saturating_add ( u32:: MAX as u64 )
1616
+ . saturating_add ( stake_amount)
1611
1617
}
1612
- None => 0 ,
1618
+ None => stake_amount ,
1613
1619
}
1614
1620
}
1615
1621
@@ -1738,8 +1744,12 @@ where
1738
1744
Pallet :: < T > :: get_priority_set_weights ( who, netuid)
1739
1745
}
1740
1746
1741
- pub fn get_priority_staking ( coldkey : & T :: AccountId , hotkey : & T :: AccountId ) -> u64 {
1742
- Pallet :: < T > :: get_priority_staking ( coldkey, hotkey)
1747
+ pub fn get_priority_staking (
1748
+ coldkey : & T :: AccountId ,
1749
+ hotkey : & T :: AccountId ,
1750
+ stake_amount : u64 ,
1751
+ ) -> u64 {
1752
+ Pallet :: < T > :: get_priority_staking ( coldkey, hotkey, stake_amount)
1743
1753
}
1744
1754
1745
1755
pub fn check_weights_min_stake ( who : & T :: AccountId , netuid : u16 ) -> bool {
@@ -1954,7 +1964,7 @@ where
1954
1964
* amount_staked,
1955
1965
false ,
1956
1966
) ,
1957
- Self :: get_priority_staking ( who, hotkey) ,
1967
+ Self :: get_priority_staking ( who, hotkey, * amount_staked ) ,
1958
1968
)
1959
1969
}
1960
1970
Some ( Call :: add_stake_limit {
@@ -1984,7 +1994,7 @@ where
1984
1994
max_amount,
1985
1995
* allow_partial,
1986
1996
) ,
1987
- Self :: get_priority_staking ( who, hotkey) ,
1997
+ Self :: get_priority_staking ( who, hotkey, * amount_staked ) ,
1988
1998
)
1989
1999
}
1990
2000
Some ( Call :: remove_stake {
@@ -2002,7 +2012,7 @@ where
2002
2012
* amount_unstaked,
2003
2013
false ,
2004
2014
) ,
2005
- Self :: get_priority_staking ( who, hotkey) ,
2015
+ Self :: get_priority_staking ( who, hotkey, * amount_unstaked ) ,
2006
2016
)
2007
2017
}
2008
2018
Some ( Call :: remove_stake_limit {
@@ -2025,7 +2035,7 @@ where
2025
2035
max_amount,
2026
2036
* allow_partial,
2027
2037
) ,
2028
- Self :: get_priority_staking ( who, hotkey) ,
2038
+ Self :: get_priority_staking ( who, hotkey, * amount_unstaked ) ,
2029
2039
)
2030
2040
}
2031
2041
Some ( Call :: move_stake {
@@ -2056,7 +2066,7 @@ where
2056
2066
None ,
2057
2067
false ,
2058
2068
) ,
2059
- Self :: get_priority_staking ( who, origin_hotkey) ,
2069
+ Self :: get_priority_staking ( who, origin_hotkey, * alpha_amount ) ,
2060
2070
)
2061
2071
}
2062
2072
Some ( Call :: transfer_stake {
@@ -2087,7 +2097,7 @@ where
2087
2097
None ,
2088
2098
true ,
2089
2099
) ,
2090
- Self :: get_priority_staking ( who, hotkey) ,
2100
+ Self :: get_priority_staking ( who, hotkey, * alpha_amount ) ,
2091
2101
)
2092
2102
}
2093
2103
Some ( Call :: swap_stake {
@@ -2117,7 +2127,7 @@ where
2117
2127
None ,
2118
2128
false ,
2119
2129
) ,
2120
- Self :: get_priority_staking ( who, hotkey) ,
2130
+ Self :: get_priority_staking ( who, hotkey, * alpha_amount ) ,
2121
2131
)
2122
2132
}
2123
2133
Some ( Call :: swap_stake_limit {
@@ -2156,7 +2166,7 @@ where
2156
2166
Some ( * allow_partial) ,
2157
2167
false ,
2158
2168
) ,
2159
- Self :: get_priority_staking ( who, hotkey) ,
2169
+ Self :: get_priority_staking ( who, hotkey, * alpha_amount ) ,
2160
2170
)
2161
2171
}
2162
2172
Some ( Call :: register { netuid, .. } | Call :: burned_register { netuid, .. } ) => {
0 commit comments