From 9364eb5132bb651c37e7e13de82a4260189c7afe Mon Sep 17 00:00:00 2001 From: Rafael Taranto Date: Thu, 7 Feb 2019 16:43:57 -0300 Subject: [PATCH] Fix cash-out exchange behavior for 'rejected' tx A TX on the 'rejected' state should still be watched for authorization. This fixes the bug where delayed cash-out confirmations would not trigger a exchange sell command. --- lib/cash-out/cash-out-atomic.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/cash-out/cash-out-atomic.js b/lib/cash-out/cash-out-atomic.js index 369ef42c..382ec519 100644 --- a/lib/cash-out/cash-out-atomic.js +++ b/lib/cash-out/cash-out-atomic.js @@ -119,10 +119,10 @@ function updateCassettes (t, tx) { } function wasJustAuthorized (oldTx, newTx, isZeroConf) { - const isAuthorized = () => _.includes(oldTx.status, ['notSeen', 'published']) && + const isAuthorized = () => _.includes(oldTx.status, ['notSeen', 'published', 'rejected']) && _.includes(newTx.status, ['authorized', 'instant', 'confirmed']) - const isConfirmed = () => _.includes(oldTx.status, ['notSeen', 'published', 'authorized']) && + const isConfirmed = () => _.includes(oldTx.status, ['notSeen', 'published', 'authorized', 'rejected']) && _.includes(newTx.status, ['instant', 'confirmed']) return isZeroConf ? isAuthorized() : isConfirmed()