[lightning] fix issue during initial node.features indexing
This commit is contained in:
parent
8fb67a914c
commit
6fe32cdd19
@ -80,17 +80,20 @@ class NodesApi {
|
|||||||
|
|
||||||
// Features
|
// Features
|
||||||
node.features = JSON.parse(node.features);
|
node.features = JSON.parse(node.features);
|
||||||
let maxBit = 0;
|
node.featuresBits = null;
|
||||||
for (const feature of node.features) {
|
if (node.features) {
|
||||||
maxBit = Math.max(maxBit, feature.bit);
|
let maxBit = 0;
|
||||||
|
for (const feature of node.features) {
|
||||||
|
maxBit = Math.max(maxBit, feature.bit);
|
||||||
|
}
|
||||||
|
maxBit = Math.ceil(maxBit / 4) * 4 - 1;
|
||||||
|
|
||||||
|
node.featuresBits = new Array(maxBit + 1).fill(0);
|
||||||
|
for (const feature of node.features) {
|
||||||
|
node.featuresBits[feature.bit] = 1;
|
||||||
|
}
|
||||||
|
node.featuresBits = bin2hex(node.featuresBits.reverse().join(''));
|
||||||
}
|
}
|
||||||
maxBit = Math.ceil(maxBit / 4) * 4 - 1;
|
|
||||||
|
|
||||||
node.featuresBits = new Array(maxBit + 1).fill(0);
|
|
||||||
for (const feature of node.features) {
|
|
||||||
node.featuresBits[feature.bit] = 1;
|
|
||||||
}
|
|
||||||
node.featuresBits = bin2hex(node.featuresBits.reverse().join(''));
|
|
||||||
|
|
||||||
// Active channels and capacity
|
// Active channels and capacity
|
||||||
const activeChannelsStats: any = await this.$getActiveChannelsStats(public_key);
|
const activeChannelsStats: any = await this.$getActiveChannelsStats(public_key);
|
||||||
|
@ -102,10 +102,10 @@
|
|||||||
</td>
|
</td>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</tr>
|
</tr>
|
||||||
<tr *ngIf="node.geolocation">
|
<tr *ngIf="node.geolocation && node.featuresBits">
|
||||||
<ng-container *ngTemplateOutlet="featurebits;context:{bits: node.featuresBits}"></ng-container>
|
<ng-container *ngTemplateOutlet="featurebits;context:{bits: node.featuresBits}"></ng-container>
|
||||||
</tr>
|
</tr>
|
||||||
<tr *ngIf="!node.geolocation" class="d-table-row d-md-none ">
|
<tr *ngIf="!node.geolocation && node.featuresBits" class="d-table-row d-md-none">
|
||||||
<ng-container *ngTemplateOutlet="featurebits;context:{bits: node.featuresBits}"></ng-container>
|
<ng-container *ngTemplateOutlet="featurebits;context:{bits: node.featuresBits}"></ng-container>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user