@@ -1909,37 +1909,24 @@ pub mod pallet {
19091909 Ok ( Some ( T :: WeightInfo :: deprecate_controller_batch ( controllers. len ( ) as u32 ) ) . into ( ) )
19101910 }
19111911
1912- /// Forcefully Unbonds by Chilling first
1912+ /// Fully Unbonds by Chilling first
19131913 /// Emits `Unbonded`.
19141914 #[ pallet:: call_index( 29 ) ]
19151915 #[ pallet:: weight(
1916- T :: WeightInfo :: withdraw_unbonded_kill( SPECULATIVE_NUM_SPANS ) . saturating_add( T :: WeightInfo :: force_unbond ( ) ) )
1916+ T :: WeightInfo :: withdraw_unbonded_kill( SPECULATIVE_NUM_SPANS ) . saturating_add( T :: WeightInfo :: full_unbond ( ) ) )
19171917 ]
1918- pub fn force_unbond (
1919- origin : OriginFor < T > ,
1920- #[ pallet:: compact] value : BalanceOf < T > ,
1921- ) -> DispatchResultWithPostInfo {
1918+ pub fn full_unbond ( origin : OriginFor < T > ) -> DispatchResultWithPostInfo {
19221919 let controller = ensure_signed ( origin) ?;
19231920
19241921 let ledger = Self :: ledger ( StakingAccount :: Controller ( controller. clone ( ) ) ) ?;
19251922
1926- let min_active_bond = if Nominators :: < T > :: contains_key ( & ledger. stash ) {
1927- MinNominatorBond :: < T > :: get ( )
1928- } else if Validators :: < T > :: contains_key ( & ledger. stash ) {
1929- MinValidatorBond :: < T > :: get ( )
1930- } else {
1931- Zero :: zero ( )
1932- } ;
1933-
1934- if ( ledger. active - value) <= min_active_bond {
1935- Self :: chill_stash ( & ledger. stash ) ;
1936- }
1923+ Self :: chill_stash ( & ledger. stash ) ;
19371924
1938- let maybe_withdraw_weight = Self :: do_unbond ( controller, value ) ?;
1925+ let maybe_withdraw_weight = Self :: do_unbond ( controller, ledger . active ) ?;
19391926 let actual_weight = if let Some ( withdraw_weight) = maybe_withdraw_weight {
1940- Some ( T :: WeightInfo :: force_unbond ( ) . saturating_add ( withdraw_weight) )
1927+ Some ( T :: WeightInfo :: full_unbond ( ) . saturating_add ( withdraw_weight) )
19411928 } else {
1942- Some ( T :: WeightInfo :: force_unbond ( ) )
1929+ Some ( T :: WeightInfo :: full_unbond ( ) )
19431930 } ;
19441931
19451932 Ok ( actual_weight. into ( ) )
0 commit comments