[lightning] start integrating features bits in the node page

This commit is contained in:
nymkappa
2023-07-05 14:00:30 +02:00
parent 4d41d36fe7
commit 556eb65320
5 changed files with 67 additions and 11 deletions

View File

@@ -6,7 +6,7 @@ import { hex2bin } from '../../../utils/format';
import config from '../../../config';
// https://github.com/lightningnetwork/lnd/blob/master/lnwire/features.go
enum FeatureBits {
export enum FeatureBits {
DataLossProtectRequired = 0,
DataLossProtectOptional = 1,
InitialRoutingSync = 3,
@@ -47,10 +47,7 @@ enum FeatureBits {
MaxBolt11Feature = 5114,
};
// Features is a mapping of known feature bits to a descriptive name. All known
// feature bits must be assigned a name in this mapping, and feature bit pairs
// must be assigned together for correct behavior.
const FeaturesMap = new Map<FeatureBits, string>([
export const FeaturesMap = new Map<FeatureBits, string>([
[FeatureBits.DataLossProtectRequired, 'data-loss-protect'],
[FeatureBits.DataLossProtectOptional, 'data-loss-protect'],
[FeatureBits.InitialRoutingSync, 'initial-routing-sync'],

View File

@@ -46,10 +46,10 @@ class LndApi implements AbstractLightningApi {
for (const node of graph.nodes) {
const nodeFeatures: ILightningApi.Feature[] = [];
for (const bit in node.features) {
for (const bit in node.features) {
nodeFeatures.push({
bit: parseInt(bit, 10),
name: node.features[bit].name,
name: node.features[bit].name,
is_required: node.features[bit].is_required,
is_known: node.features[bit].is_known,
});