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

cln delexpiredinvoices deprecation fix #1459

Merged
merged 1 commit into from
Nov 7, 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: 2 additions & 2 deletions backend/controllers/cln/invoices.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ export const deleteExpiredInvoice = (req, res, next) => {
if (options.error) {
return res.status(options.statusCode).json({ message: options.message, error: options.error });
}
options.url = req.session.selectedNode.settings.lnServerUrl + '/v1/delexpiredinvoice';
options.url = req.session.selectedNode.settings.lnServerUrl + '/v1/autoclean-once';
options.body = req.body;
request.post(options).then((body) => {
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'Invoice', msg: 'Invoices Deleted', data: body });
res.status(204).json({ status: 'Invoice Deleted Successfully' });
res.status(201).json({ status: 'Cleaned Invoices: ' + body.autoclean.expiredinvoices.cleaned + ', Uncleaned Invoices: ' + body.autoclean.expiredinvoices.uncleaned });
}).catch((errRes) => {
const err = common.handleError(errRes, 'Invoice', 'Delete Invoice Error', req.session.selectedNode);
return res.status(err.statusCode).json({ message: err.message, error: err.error });
Expand Down
2 changes: 1 addition & 1 deletion frontend/index.html

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion frontend/main.245ed746fe5b3671.js

This file was deleted.

1 change: 1 addition & 0 deletions frontend/main.7dce29d41488d533.js

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions server/controllers/cln/invoices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ export const deleteExpiredInvoice = (req, res, next) => {
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'Invoices', msg: 'Deleting Expired Invoices..' });
options = common.getOptions(req);
if (options.error) { return res.status(options.statusCode).json({ message: options.message, error: options.error }); }
options.url = req.session.selectedNode.settings.lnServerUrl + '/v1/delexpiredinvoice';
options.url = req.session.selectedNode.settings.lnServerUrl + '/v1/autoclean-once';
options.body = req.body;
request.post(options).then((body) => {
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'Invoice', msg: 'Invoices Deleted', data: body });
res.status(204).json({ status: 'Invoice Deleted Successfully' });
res.status(201).json({ status: 'Cleaned Invoices: ' + body.autoclean.expiredinvoices.cleaned + ', Uncleaned Invoices: ' + body.autoclean.expiredinvoices.uncleaned });
}).catch((errRes) => {
const err = common.handleError(errRes, 'Invoice', 'Delete Invoice Error', req.session.selectedNode);
return res.status(err.statusCode).json({ message: err.message, error: err.error });
Expand Down
7 changes: 4 additions & 3 deletions src/app/cln/store/cln.effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import { ErrorMessageComponent } from '../../shared/components/data-modal/error-message/error-message.component';
import { CLNInvoiceInformationComponent } from '../transactions/invoices/invoice-information-modal/invoice-information.component';
import { GetInfo, Payment, FeeRates, ListInvoices, Invoice, Peer, OnChain, QueryRoutes, SaveChannel, GetNewAddress, DetachPeer, UpdateChannel, CloseChannel, SendPayment, GetQueryRoutes, ChannelLookup, Channel, OfferInvoice, Offer } from '../../shared/models/clnModels';
import { API_URL, API_END_POINTS, AlertTypeEnum, APICallStatusEnum, UI_MESSAGES, CLNWSEventTypeEnum, CLNActions, RTLActions, CLNForwardingEventsStatusEnum } from '../../shared/services/consts-enums-functions';
import { API_URL, API_END_POINTS, SECS_IN_YEAR, AlertTypeEnum, APICallStatusEnum, UI_MESSAGES, CLNWSEventTypeEnum, CLNActions, RTLActions, CLNForwardingEventsStatusEnum } from '../../shared/services/consts-enums-functions';
import { closeAllDialogs, closeSpinner, logout, openAlert, openSnackBar, openSpinner, setApiUrl, setNodeData } from '../../store/rtl.actions';

import { RTLState } from '../../store/rtl.state';
Expand Down Expand Up @@ -608,12 +608,13 @@
ofType(CLNActions.DELETE_EXPIRED_INVOICE_CLN),
mergeMap((action: { type: string, payload: number }) => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.DELETE_INVOICE }));
return this.httpClient.post(this.CHILD_API_URL + API_END_POINTS.INVOICES_API + '/delete', { maxexpiry: action.payload }).
return this.httpClient.post(this.CHILD_API_URL + API_END_POINTS.INVOICES_API + '/delete', { 'subsystem': 'expiredinvoices', 'age': SECS_IN_YEAR }).

Check failure on line 611 in src/app/cln/store/cln.effects.ts

View workflow job for this annotation

GitHub Actions / Lint

Unnecessarily quoted property 'subsystem' found

Check failure on line 611 in src/app/cln/store/cln.effects.ts

View workflow job for this annotation

GitHub Actions / Lint

Unnecessarily quoted property 'age' found
pipe(
map((postRes: any) => {
console.warn(postRes);

Check failure on line 614 in src/app/cln/store/cln.effects.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected console statement
this.logger.info(postRes);
this.store.dispatch(closeSpinner({ payload: UI_MESSAGES.DELETE_INVOICE }));
this.store.dispatch(openSnackBar({ payload: 'Invoices Deleted Successfully!' }));
this.store.dispatch(openSnackBar({ payload: postRes.status }));
return { type: CLNActions.FETCH_INVOICES_CLN };
}),
catchError((err: any) => {
Expand Down
1 change: 1 addition & 0 deletions src/app/shared/services/consts-enums-functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export function getPaginatorLabel(field: string) {
}

export const HOUR_SECONDS = 3600;
export const SECS_IN_YEAR = 31536000;

export const DEFAULT_INVOICE_EXPIRY = HOUR_SECONDS * 24 * 7;

Expand Down
Loading