Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Remove the lightning prefix from the lnInvoice" #576

Merged
merged 1 commit into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

Loading