refactor: don't build virtualRecyclers in case of error

This commit is contained in:
siiky 2023-10-23 11:32:38 +01:00
parent 3accb2b54e
commit f2d07c8cc7

View file

@ -207,11 +207,8 @@ function plugins (settings, deviceId) {
_.range(1, numberOfRecyclers+1)
)
const virtualRecyclers = denominations.length ? [Math.max(..._.flatten(denominations)) * 2] : []
if (counts.length !== denominations.length) {
if (counts.length !== denominations.length)
throw new Error('Denominations and respective counts do not match!')
}
const recyclers = _.map(
it => ({
@ -223,6 +220,8 @@ function plugins (settings, deviceId) {
_.range(0, numberOfRecyclers)
)
const virtualRecyclers = denominations.length ? [Math.max(..._.flatten(denominations)) * 2] : []
try {
return {
recyclers: computeAvailableRecyclers(recyclers, redeemableTxs),