From 5465c20428e452eb5b348337bc2b63c45b6fe84a Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Fri, 2 Feb 2024 23:08:22 -0800 Subject: [PATCH] fixup! overdrawn atomicity --- packages/ERTP/src/paymentLedger.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/ERTP/src/paymentLedger.js b/packages/ERTP/src/paymentLedger.js index cb6c7ec6e396..a20f6e4be5e3 100644 --- a/packages/ERTP/src/paymentLedger.js +++ b/packages/ERTP/src/paymentLedger.js @@ -277,11 +277,11 @@ export const preparePaymentLedger = ( const withdrawInternal = (balanceStore, amount, recoverySet) => { amount = coerce(amount); const payment = makePayment(); + // COMMIT POINT Move the withdrawn assets from this purse into + // payment. Total assets must remain conserved. + balanceStore.decrement(amount) || + Fail`Withdrawal of ${amount} failed because the purse only contained ${balanceStore.getAmount()}`; try { - // COMMIT POINT Move the withdrawn assets from this purse into - // payment. Total assets must remain conserved. - balanceStore.decrement(amount) || - Fail`Withdrawal of ${amount} failed because the purse only contained ${balanceStore.getAmount()}`; initPayment(payment, amount, recoverySet); } catch (err) { shutdownLedgerWithFailure(err);