Skip to content

Commit

Permalink
Merge pull request #1292 from Ride-The-Lightning/cln-prefix-version-fix
Browse files Browse the repository at this point in the history
Bug Fix: CLN version check error with prefix `basedon`
  • Loading branch information
ShahanaFarooqui authored Sep 27, 2023
2 parents 9768963 + 281e51e commit 168aa3b
Show file tree
Hide file tree
Showing 16 changed files with 186 additions and 359 deletions.
1 change: 0 additions & 1 deletion frontend/167.a3774800f5f9ed5a.js

This file was deleted.

1 change: 1 addition & 0 deletions frontend/167.dd2d5e68e84841c0.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions frontend/267.3050ada6a6d9afd8.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion frontend/267.5508f97536cb5708.js

This file was deleted.

1 change: 1 addition & 0 deletions frontend/315.25112d0bface4bf2.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion frontend/315.65bfb08cef6643f9.js

This file was deleted.

505 changes: 162 additions & 343 deletions frontend/3rdpartylicenses.txt

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions frontend/636.b883c00cebb300aa.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion frontend/636.eaef3bec0eb4cb7a.js

This file was deleted.

2 changes: 1 addition & 1 deletion frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
<style>html{width:100%;height:99%;line-height:1.5;overflow-x:hidden;font-family:Roboto,sans-serif!important;font-size:95%}@media only screen and (max-width: 56.25em){html{font-size:90%}}@media only screen and (max-width: 37.5em){html{font-size:80%}}body{box-sizing:border-box;height:100%;margin:0;overflow:hidden}*{margin:0;padding:0}@font-face{font-family:Roboto;src:url(Roboto-Thin.f7a95c9c5999532c.woff2) format("woff2"),url(Roboto-Thin.c13c157cb81e8ebb.woff) format("woff");font-weight:100;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-ThinItalic.b0e084abf689f393.woff2) format("woff2"),url(Roboto-ThinItalic.1111028df6cea564.woff) format("woff");font-weight:100;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Light.0e01b6cd13b3857f.woff2) format("woff2"),url(Roboto-Light.603ca9a537b88428.woff) format("woff");font-weight:300;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-LightItalic.232ef4b20215f720.woff2) format("woff2"),url(Roboto-LightItalic.1b5e142f787151c8.woff) format("woff");font-weight:300;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Regular.475ba9e4e2d63456.woff2) format("woff2"),url(Roboto-Regular.bcefbfee882bc1cb.woff) format("woff");font-weight:400;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-RegularItalic.e3a9ebdaac06bbc4.woff2) format("woff2"),url(Roboto-RegularItalic.0668fae6af0cf8c2.woff) format("woff");font-weight:400;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Medium.457532032ceb0168.woff2) format("woff2"),url(Roboto-Medium.6e1ae5f0b324a0aa.woff) format("woff");font-weight:500;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-MediumItalic.872f7060602d55d2.woff2) format("woff2"),url(Roboto-MediumItalic.e06fb533801cbb08.woff) format("woff");font-weight:500;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Bold.447291a88c067396.woff2) format("woff2"),url(Roboto-Bold.fc482e6133cf5e26.woff) format("woff");font-weight:700;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-BoldItalic.1b15168ef6fa4e16.woff2) format("woff2"),url(Roboto-BoldItalic.e26ba339b06f09f7.woff) format("woff");font-weight:700;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Black.2eaa390d458c877d.woff2) format("woff2"),url(Roboto-Black.b25f67ad8583da68.woff) format("woff");font-weight:900;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-BlackItalic.7dc03ee444552bc5.woff2) format("woff2"),url(Roboto-BlackItalic.c8dc642467cb3099.woff) format("woff");font-weight:900;font-style:italic}</style><link rel="stylesheet" href="styles.a04c018645a5044a.css" media="print" onload="this.media='all'"><noscript><link rel="stylesheet" href="styles.a04c018645a5044a.css"></noscript></head>
<body>
<rtl-app></rtl-app>
<script src="runtime.2be0df304d901cfb.js" type="module"></script><script src="polyfills.aa01d8f6b94657cb.js" type="module"></script><script src="main.88ad6ebbc2d60d3b.js" type="module"></script>
<script src="runtime.3a45b77bd75b000d.js" type="module"></script><script src="polyfills.aa01d8f6b94657cb.js" type="module"></script><script src="main.fb42cd8eec8f581b.js" type="module"></script>

</body></html>
1 change: 0 additions & 1 deletion frontend/main.88ad6ebbc2d60d3b.js

This file was deleted.

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

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion frontend/runtime.2be0df304d901cfb.js

This file was deleted.

1 change: 1 addition & 0 deletions frontend/runtime.3a45b77bd75b000d.js

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

8 changes: 4 additions & 4 deletions src/app/cln/store/cln.effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { RTLState } from '../../store/rtl.state';
import { addUpdateOfferBookmark, fetchBalance, fetchChannels, fetchFeeRates, fetchFees, fetchInvoices, fetchLocalRemoteBalance,
fetchPayments, fetchPeers, fetchUTXOs, setLookup, setPeers, setQueryRoutes, updateCLAPICallStatus, updateInvoice, setOfferInvoice,
sendPaymentStatus, setForwardingHistory, fetchPageSettings } from './cln.actions';
import { allAPIsCallStatus, clnNodeInformation, nodeInfoAndBalance } from './cln.selector';
import { allAPIsCallStatus } from './cln.selector';
import { ApiCallsListCL } from '../../shared/models/apiCallsPayload';
import { CLNOfferInformationComponent } from '../transactions/offers/offer-information-modal/offer-information.component';

Expand All @@ -30,7 +30,7 @@ export class CLNEffects implements OnDestroy {

CHILD_API_URL = API_URL + '/cln';
API_VERION = '';
NODE_VERISON = '';
CLN_VERISON = '';
private flgInitialized = false;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject()];

Expand Down Expand Up @@ -97,7 +97,7 @@ export class CLNEffects implements OnDestroy {
map((info) => {
this.logger.info(info);
this.API_VERION = info.api_version || '';
this.NODE_VERISON = info.version || '';
this.CLN_VERISON = info.version || '';
if (info.chains && info.chains.length && info.chains[0] &&
(typeof info.chains[0] === 'object' && info.chains[0].hasOwnProperty('chain') && info?.chains[0].chain &&
(info?.chains[0].chain.toLowerCase().indexOf('bitcoin') < 0 && info?.chains[0].chain.toLowerCase().indexOf('liquid') < 0)
Expand Down Expand Up @@ -331,7 +331,7 @@ export class CLNEffects implements OnDestroy {
mergeMap(() => {
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'FetchChannels', status: APICallStatusEnum.INITIATED } }));
const listChannelsEndpoint =
this.commonService.isVersionCompatible(this.NODE_VERISON, '23.02') &&
this.commonService.isVersionCompatible(this.CLN_VERISON, '23.02') &&
this.commonService.isVersionCompatible(this.API_VERION, '0.10.3') ?
'/listPeerChannels' : '/listChannels';
return this.httpClient.get<Channel[]>(this.CHILD_API_URL + API_END_POINTS.CHANNELS_API + listChannelsEndpoint);
Expand Down
18 changes: 13 additions & 5 deletions src/app/shared/services/common.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,11 +298,19 @@ export class CommonService implements OnDestroy {
isVersionCompatible(currentVersion, checkVersion) {
// Check for newer CLN version style compatibility
if (currentVersion) {
const versionsArr = currentVersion.trim()?.replace('v', '').split('-')[0].split('.') || [];
const checkVersionsArr = checkVersion.split('.');
return (+versionsArr[0] > +checkVersionsArr[0]) ||
(+versionsArr[0] === +checkVersionsArr[0] && +versionsArr[1] > +checkVersionsArr[1]) ||
(+versionsArr[0] === +checkVersionsArr[0] && +versionsArr[1] === +checkVersionsArr[1] && +versionsArr[2] >= +checkVersionsArr[2]);
const match = currentVersion.match(/v?(?<version>\d+(?:\.\d+)*)/);
if (match && match.groups && match.groups.version) {
this.logger.info('Current Version: ' + match.groups.version);
this.logger.info('Checking Compatiblility with Version: ' + checkVersion);
const versionsArr = match.groups.version.split('.') || [];
const checkVersionsArr = checkVersion.split('.');
return (+versionsArr[0] > +checkVersionsArr[0]) ||
(+versionsArr[0] === +checkVersionsArr[0] && +versionsArr[1] > +checkVersionsArr[1]) ||
(+versionsArr[0] === +checkVersionsArr[0] && +versionsArr[1] === +checkVersionsArr[1] && +versionsArr[2] >= +checkVersionsArr[2]);
} else {
this.logger.error('Invalid Version String: ' + currentVersion);
return false;
}
}
return false;
}
Expand Down

0 comments on commit 168aa3b

Please sign in to comment.