Check array before running bnMax (#893)
* Updated with derive.balances.all * add new keys to votingBalance * remove multi test * vestedBalance > 0 * bestNumber bug * Check balances.all > 0 * Check balances.all > 0 * Check balances.all > 0 * check locks array * check locks array
This commit is contained in:
@@ -37,7 +37,7 @@ export function all (api: ApiInterface$Rx) {
|
||||
// only get the locks that are valid until passed the current block
|
||||
const totals = locks.filter((value) => bestNumber && value.until.gt(bestNumber));
|
||||
// get the maximum of the locks according to https://github.com/paritytech/substrate/blob/master/srml/balances/src/lib.rs#L699
|
||||
lockedBalance = bnMax(...totals.map(({ amount }) => amount)) as Balance;
|
||||
lockedBalance = totals[0] ? bnMax(...totals.map(({ amount }) => amount)) as Balance : new Balance(0);
|
||||
}
|
||||
|
||||
const { offset, perBlock } = vesting.unwrapOr({
|
||||
|
||||
Reference in New Issue
Block a user