Convert short_id to integer id with clightning backend before returning the graph

This commit is contained in:
nymkappa 2022-08-10 15:09:34 +02:00
parent 7012a480e8
commit 48a0a6c7e3
No known key found for this signature in database
GPG Key ID: E155910B16E8BD04
3 changed files with 3 additions and 7 deletions

View File

@ -202,10 +202,6 @@ export class Common {
/** Decodes a channel id returned by lnd as uint64 to a short channel id */
static channelIntegerIdToShortId(id: string): string {
if (config.LIGHTNING.BACKEND === 'cln') {
return id;
}
const n = BigInt(id);
return [
n >> 40n, // nth block

View File

@ -420,7 +420,7 @@ class ChannelsApi {
const result = await DB.query<ResultSetHeader>(`
UPDATE channels
SET status = 0
WHERE short_id NOT IN (
WHERE id NOT IN (
${graphChannelsIds.map(id => `"${id}"`).join(',')}
)
AND status != 2

View File

@ -90,7 +90,7 @@ async function buildFullChannel(clChannelA: any, clChannelB: any): Promise<ILigh
const outputIdx = parts[2];
return {
channel_id: clChannelA.short_channel_id,
channel_id: convertChannelId(clChannelA.short_channel_id),
capacity: clChannelA.satoshis,
last_update: lastUpdate,
node1_policy: convertPolicy(clChannelA),
@ -111,7 +111,7 @@ async function buildIncompleteChannel(clChannel: any): Promise<ILightningApi.Cha
const outputIdx = parts[2];
return {
channel_id: clChannel.short_channel_id,
channel_id: convertChannelId(clChannel.short_channel_id),
capacity: clChannel.satoshis,
last_update: clChannel.last_update ?? 0,
node1_policy: convertPolicy(clChannel),