[lightning] start integrating features bits in the node page
This commit is contained in:
@@ -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'],
|
||||
|
||||
@@ -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,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user