Skip to content

Commit

Permalink
Fix cancelall to cancel hold invoice paid when a waiting-buyer-invoic…
Browse files Browse the repository at this point in the history
…e order is canceled (lnp2pBot#566)
  • Loading branch information
Catrya authored Aug 15, 2024
1 parent df0a236 commit 84f3a0f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion bot/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,12 @@ const initialize = (botToken: string, options: Partial<Telegraf.Options<MainCont
if (order.type === 'buy' && order.status === 'WAITING_PAYMENT') {
return await cancelShowHoldInvoice(ctx, order);
}


// If a buyer wants cancel but the seller already pay the hold invoice
if (order.type === 'buy' && order.status === 'WAITING_BUYER_INVOICE') {
if (order.hash) await cancelHoldInvoice({ hash: order.hash });
}

order.status = 'CANCELED';
order.canceled_by = ctx.user.id;
await order.save();
Expand Down

0 comments on commit 84f3a0f

Please sign in to comment.