Skip to content

Commit

Permalink
cln delexpiredinvoices deprecation fix (#1459)
Browse files Browse the repository at this point in the history
Closes #1444
  • Loading branch information
ShahanaFarooqui authored Nov 7, 2024
1 parent a08d502 commit 295fce0
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 10 deletions.
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 { WebSocketClientService } from '../../shared/services/web-socket.service
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 @@ export class CLNEffects implements OnDestroy {
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 }).
pipe(
map((postRes: any) => {
console.warn(postRes);
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

0 comments on commit 295fce0

Please sign in to comment.