Skip to content

Commit

Permalink
Revert "Remove the lightning prefix from the lnInvoice (#572)" (#576)
Browse files Browse the repository at this point in the history
This reverts commit 5ae85c6.
  • Loading branch information
grunch authored Aug 29, 2024
1 parent 5ae85c6 commit d105925
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 21 deletions.
4 changes: 1 addition & 3 deletions bot/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const OrderEvents = require('./modules/events/orders');

const { resolvLightningAddress } = require('../lnurl/lnurl-pay');
const { logger } = require('../logger');
const { removeLightningPrefix } = require('../util/valitationUtils');

const waitPayment = async (ctx, bot, buyer, seller, order, buyerInvoice) => {
try {
Expand All @@ -33,8 +32,7 @@ const waitPayment = async (ctx, bot, buyer, seller, order, buyerInvoice) => {
return;
}

// ISSUE: 542
order.buyer_invoice = removeLightningPrefix(buyerInvoice);
order.buyer_invoice = buyerInvoice;
// We need the i18n context to send the message with the correct language
const i18nCtx = await getUserI18nContext(seller);
// If the buyer is the creator, at this moment the seller already paid the hold invoice
Expand Down
9 changes: 2 additions & 7 deletions bot/validations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { Order, User, Community } from '../models';
import { isIso4217, isDisputeSolver } from '../util';
const { existLightningAddress } = require('../lnurl/lnurl-pay');
import { logger } from '../logger';
import { removeLightningPrefix } from '../util/valitationUtils';

// We look in database if the telegram user exists,
// if not, it creates a new user
Expand Down Expand Up @@ -327,9 +326,7 @@ const validateLightningAddress = async (lightningAddress: string) => {

const validateInvoice = async (ctx: MainContext, lnInvoice: string) => {
try {
// ISSUE: 542
const checkedPrefixlnInvoice = removeLightningPrefix(lnInvoice);
const invoice = parsePaymentRequest({ request: checkedPrefixlnInvoice });
const invoice = parsePaymentRequest({ request: lnInvoice });
const latestDate = new Date(
Date.now() + Number(process.env.INVOICE_EXPIRATION_WINDOW)
);
Expand Down Expand Up @@ -369,9 +366,7 @@ const validateInvoice = async (ctx: MainContext, lnInvoice: string) => {

const isValidInvoice = async (ctx: MainContext, lnInvoice: string) => {
try {
// ISSUE: 542
const checkedPrefixlnInvoice = removeLightningPrefix(lnInvoice);
const invoice = parsePaymentRequest({ request: checkedPrefixlnInvoice });
const invoice = parsePaymentRequest({ request: lnInvoice });
const latestDate = new Date(
Date.now() + Number(process.env.INVOICE_EXPIRATION_WINDOW)
).toISOString();
Expand Down
11 changes: 0 additions & 11 deletions util/valitationUtils.ts

This file was deleted.

0 comments on commit d105925

Please sign in to comment.