From 2df54411c3ce0aa16b2f79d38657c3b60e5f58a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Salgado?= Date: Mon, 28 Feb 2022 18:49:57 +0000 Subject: [PATCH] feat: add cryptoAtoms positive value sanity check --- lib/wallet.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/wallet.js b/lib/wallet.js index 161dc519..60a395cf 100644 --- a/lib/wallet.js +++ b/lib/wallet.js @@ -193,7 +193,9 @@ function getStatus (settings, tx, machineId) { ? 'published' : 'rejected' - const status = isAuthorized ? 'authorized' : unauthorizedStatus + // Sanity check to confirm if there's any cryptoatoms for which to dispense bills + const authorizedStatus = isAuthorized ? 'authorized' : unauthorizedStatus + const status = BN(tx.cryptoAtoms).gt(0) ? authorizedStatus : 'rejected' return { receivedCryptoAtoms: statusRec.receivedCryptoAtoms, status } })