mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-19 04:11:09 +00:00
[Fix] Remove redundant stash from Stake (#13907)
* [Fix] Remove redundant stash from Stake * fix tests
This commit is contained in:
@@ -122,9 +122,9 @@ impl sp_staking::StakingInterface for StakingMock {
|
|||||||
BondedBalanceMap::get().get(who).copied(),
|
BondedBalanceMap::get().get(who).copied(),
|
||||||
) {
|
) {
|
||||||
(None, None) => Err(DispatchError::Other("balance not found")),
|
(None, None) => Err(DispatchError::Other("balance not found")),
|
||||||
(Some(v), None) => Ok(Stake { total: v, active: 0, stash: *who }),
|
(Some(v), None) => Ok(Stake { total: v, active: 0 }),
|
||||||
(None, Some(v)) => Ok(Stake { total: v, active: v, stash: *who }),
|
(None, Some(v)) => Ok(Stake { total: v, active: v }),
|
||||||
(Some(a), Some(b)) => Ok(Stake { total: a + b, active: b, stash: *who }),
|
(Some(a), Some(b)) => Ok(Stake { total: a + b, active: b }),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1611,7 +1611,7 @@ impl<T: Config> StakingInterface for Pallet<T> {
|
|||||||
fn stake(who: &Self::AccountId) -> Result<Stake<Self>, DispatchError> {
|
fn stake(who: &Self::AccountId) -> Result<Stake<Self>, DispatchError> {
|
||||||
Self::bonded(who)
|
Self::bonded(who)
|
||||||
.and_then(|c| Self::ledger(c))
|
.and_then(|c| Self::ledger(c))
|
||||||
.map(|l| Stake { stash: l.stash, total: l.total, active: l.active })
|
.map(|l| Stake { total: l.total, active: l.active })
|
||||||
.ok_or(Error::<T>::NotStash.into())
|
.ok_or(Error::<T>::NotStash.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -58,8 +58,6 @@ impl<AccountId, Balance> OnStakerSlash<AccountId, Balance> for () {
|
|||||||
/// A struct that reflects stake that an account has in the staking system. Provides a set of
|
/// A struct that reflects stake that an account has in the staking system. Provides a set of
|
||||||
/// methods to operate on it's properties. Aimed at making `StakingInterface` more concise.
|
/// methods to operate on it's properties. Aimed at making `StakingInterface` more concise.
|
||||||
pub struct Stake<T: StakingInterface + ?Sized> {
|
pub struct Stake<T: StakingInterface + ?Sized> {
|
||||||
/// The stash account whose balance is actually locked and at stake.
|
|
||||||
pub stash: T::AccountId,
|
|
||||||
/// The total stake that `stash` has in the staking system. This includes the
|
/// The total stake that `stash` has in the staking system. This includes the
|
||||||
/// `active` stake, and any funds currently in the process of unbonding via
|
/// `active` stake, and any funds currently in the process of unbonding via
|
||||||
/// [`StakingInterface::unbond`].
|
/// [`StakingInterface::unbond`].
|
||||||
|
|||||||
Reference in New Issue
Block a user