[lightning] save bit number when converting features from clightning

This commit is contained in:
nymkappa 2023-07-05 11:17:04 +02:00
parent 1f003cc292
commit 32d46ad7ac
No known key found for this signature in database
GPG key ID: E155910B16E8BD04
3 changed files with 7 additions and 1 deletions

View file

@ -56,7 +56,8 @@ class NodesApi {
UNIX_TIMESTAMP(updated_at) AS updated_at, color, sockets as sockets, UNIX_TIMESTAMP(updated_at) AS updated_at, color, sockets as sockets,
as_number, city_id, country_id, subdivision_id, longitude, latitude, as_number, city_id, country_id, subdivision_id, longitude, latitude,
geo_names_iso.names as iso_code, geo_names_as.names as as_organization, geo_names_city.names as city, geo_names_iso.names as iso_code, geo_names_as.names as as_organization, geo_names_city.names as city,
geo_names_country.names as country, geo_names_subdivision.names as subdivision geo_names_country.names as country, geo_names_subdivision.names as subdivision,
features
FROM nodes FROM nodes
LEFT JOIN geo_names geo_names_as on geo_names_as.id = as_number LEFT JOIN geo_names geo_names_as on geo_names_as.id = as_number
LEFT JOIN geo_names geo_names_city on geo_names_city.id = city_id LEFT JOIN geo_names geo_names_city on geo_names_city.id = city_id
@ -76,6 +77,8 @@ class NodesApi {
node.city = JSON.parse(node.city); node.city = JSON.parse(node.city);
node.country = JSON.parse(node.country); node.country = JSON.parse(node.country);
node.features = JSON.parse(node.features);
// Active channels and capacity // Active channels and capacity
const activeChannelsStats: any = await this.$getActiveChannelsStats(public_key); const activeChannelsStats: any = await this.$getActiveChannelsStats(public_key);
node.active_channel_count = activeChannelsStats.active_channel_count ?? 0; node.active_channel_count = activeChannelsStats.active_channel_count ?? 0;

View file

@ -114,12 +114,14 @@ export function convertNode(clNode: any): ILightningApi.Node {
const feature = FeaturesMap.get(i); const feature = FeaturesMap.get(i);
if (!feature) { if (!feature) {
nodeFeatures.push({ nodeFeatures.push({
bit: i,
name: 'unknown', name: 'unknown',
is_required: i % 2 === 0, is_required: i % 2 === 0,
is_known: false is_known: false
}); });
} else { } else {
nodeFeatures.push({ nodeFeatures.push({
bit: i,
name: feature, name: feature,
is_required: i % 2 === 0, is_required: i % 2 === 0,
is_known: true is_known: true

View file

@ -79,6 +79,7 @@ export namespace ILightningApi {
} }
export interface Feature { export interface Feature {
bit: number;
name: string; name: string;
is_required: boolean; is_required: boolean;
is_known: boolean; is_known: boolean;