mirror of
https://github.com/lnbits/lnbits.git
synced 2025-10-09 20:12:34 +02:00
bugfix: 500 error if same wallet tries to pay an external invoice twice (#1594)
* bugfix: 500 error if same wallet tries to pay an external invoice twice * fstring * log the error --------- Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>
This commit is contained in:
@@ -174,12 +174,17 @@ async def pay_invoice(
|
|||||||
logger.debug(f"creating temporary payment with id {temp_id}")
|
logger.debug(f"creating temporary payment with id {temp_id}")
|
||||||
# create a temporary payment here so we can check if
|
# create a temporary payment here so we can check if
|
||||||
# the balance is enough in the next step
|
# the balance is enough in the next step
|
||||||
|
try:
|
||||||
await create_payment(
|
await create_payment(
|
||||||
checking_id=temp_id,
|
checking_id=temp_id,
|
||||||
fee=-fee_reserve_msat,
|
fee=-fee_reserve_msat,
|
||||||
conn=conn,
|
conn=conn,
|
||||||
**payment_kwargs,
|
**payment_kwargs,
|
||||||
)
|
)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"could not create temporary payment: {e}")
|
||||||
|
# happens if the same wallet tries to pay an invoice twice
|
||||||
|
raise PaymentFailure("Could not make payment.")
|
||||||
|
|
||||||
# do the balance check
|
# do the balance check
|
||||||
wallet = await get_wallet(wallet_id, conn=conn)
|
wallet = await get_wallet(wallet_id, conn=conn)
|
||||||
|
Reference in New Issue
Block a user