From 4d41d36fe768493ef98716502b741decdcd8799a Mon Sep 17 00:00:00 2001 From: nymkappa <1612910616@pm.me> Date: Wed, 5 Jul 2023 11:28:13 +0200 Subject: [PATCH] [lightning] save feature bit number when using lnd describegraph --- backend/src/api/lightning/lnd/lnd-api.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/backend/src/api/lightning/lnd/lnd-api.ts b/backend/src/api/lightning/lnd/lnd-api.ts index b4c91d36e..eb48b5f96 100644 --- a/backend/src/api/lightning/lnd/lnd-api.ts +++ b/backend/src/api/lightning/lnd/lnd-api.ts @@ -41,8 +41,23 @@ class LndApi implements AbstractLightningApi { } async $getNetworkGraph(): Promise { - return axios.get(config.LND.REST_API_URL + '/v1/graph', this.axiosConfig) + const graph = await axios.get(config.LND.REST_API_URL + '/v1/graph', this.axiosConfig) .then((response) => response.data); + + for (const node of graph.nodes) { + const nodeFeatures: ILightningApi.Feature[] = []; + for (const bit in node.features) { + nodeFeatures.push({ + bit: parseInt(bit, 10), + name: node.features[bit].name, + is_required: node.features[bit].is_required, + is_known: node.features[bit].is_known, + }); + } + node.features = nodeFeatures; + } + + return graph; } }