Fix targets with zero input (#2989)
* Fix targets with zero input * Simpler or check
This commit is contained in:
parent
e14397bebd
commit
a393d2eae8
@ -110,6 +110,7 @@ function Targets ({ className = '', ownStashes, targets: { calcWith, lastReward,
|
||||
className='balanceInput'
|
||||
help={t<string>('The amount that will be used on a per-validator basis to calculate profits for that validator.')}
|
||||
isFull
|
||||
isZeroable={false}
|
||||
label={t<string>('amount to use for estimation')}
|
||||
onChange={setCalcWith}
|
||||
value={calcWith}
|
||||
|
||||
@ -84,9 +84,9 @@ function extractInfo (allAccounts: string[], amount: BN = baseBalance(), elected
|
||||
: (prefs as ValidatorPrefs).commission.unwrap().mul(perValidatorReward).div(PERBILL);
|
||||
const key = accountId.toString();
|
||||
const rewardSplit = perValidatorReward.sub(validatorPayment);
|
||||
const rewardPayout = rewardSplit.gtn(0)
|
||||
? amount.mul(rewardSplit).div(amount.add(bondTotal))
|
||||
: BN_ZERO;
|
||||
const rewardPayout = amount.isZero() || rewardSplit.isZero()
|
||||
? BN_ZERO
|
||||
: amount.mul(rewardSplit).div(amount.add(bondTotal));
|
||||
const isNominating = exposure.others.reduce((isNominating, indv): boolean => {
|
||||
const nominator = indv.who.toString();
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user