From 0263aa83725184b1495ac25b063438ca9f555124 Mon Sep 17 00:00:00 2001 From: Riccardo Balbo Date: Wed, 16 Oct 2024 10:17:04 +0200 Subject: [PATCH] do not test invoice when disabling wallets --- api/resolvers/wallet.js | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/api/resolvers/wallet.js b/api/resolvers/wallet.js index 4ec27a8c..11914f76 100644 --- a/api/resolvers/wallet.js +++ b/api/resolvers/wallet.js @@ -672,7 +672,10 @@ async function upsertWallet ( if (!me) throw new GqlAuthenticationError() assertApiKeyNotPermitted({ me }) - if (testCreateInvoice && !priorityOnly && canReceive) { + const { id, ...walletData } = data + const { autoWithdrawThreshold, autoWithdrawMaxFeePercent, enabled, priority } = settings + + if (testCreateInvoice && !priorityOnly && canReceive && enabled) { try { await testCreateInvoice(data) } catch (err) { @@ -685,15 +688,6 @@ async function upsertWallet ( } } - const { id, ...walletData } = data - const { - autoWithdrawThreshold, - autoWithdrawMaxFeePercent, - autoWithdrawMaxFeeTotal, - enabled, - priority - } = settings - return await models.$transaction(async (tx) => { if (canReceive) { await tx.user.update({