@@ -842,7 +842,7 @@ pub(crate) fn do_unlock_funds<T: Config>(
842842 } ) ;
843843 }
844844
845- Ok ( amount_to_release )
845+ Ok ( amount_to_unlock )
846846 } )
847847}
848848
@@ -886,16 +886,19 @@ pub(crate) fn do_unlock_operator<T: Config>(operator_id: OperatorId) -> Result<(
886886 // if the withdrawals has share price noted, then convert them to SSC
887887 // if no share price, then it must be intitated in the epoch when operator was slashed,
888888 // so get the shares as is and include them in the total staked shares.
889- let mut withdrawal =
890- Withdrawals :: < T > :: take ( operator_id, nominator_id. clone ( ) ) . unwrap_or_default ( ) ;
891- do_convert_previous_epoch_withdrawal :: < T > ( operator_id, & mut withdrawal) ?;
892- let ( amount_ready_to_withdraw, shares_withdrew_in_current_epoch) = (
893- withdrawal. total_withdrawal_amount ,
894- withdrawal
895- . withdrawal_in_shares
896- . map ( |( _, _, shares) | shares)
897- . unwrap_or_default ( ) ,
898- ) ;
889+ let ( amount_ready_to_withdraw, shares_withdrew_in_current_epoch) =
890+ Withdrawals :: < T > :: take ( operator_id, nominator_id. clone ( ) )
891+ . map ( |mut withdrawal| {
892+ do_convert_previous_epoch_withdrawal :: < T > ( operator_id, & mut withdrawal) ?;
893+ Ok ( (
894+ withdrawal. total_withdrawal_amount ,
895+ withdrawal
896+ . withdrawal_in_shares
897+ . map ( |( _, _, shares) | shares)
898+ . unwrap_or_default ( ) ,
899+ ) )
900+ } )
901+ . unwrap_or ( Ok ( ( Zero :: zero ( ) , Zero :: zero ( ) ) ) ) ?;
899902
900903 // include all the known shares and shares that were withdrawn in the current epoch
901904 let nominator_shares = deposit
0 commit comments