Convert short_id to integer id with clightning backend before returning the graph
This commit is contained in:
parent
7012a480e8
commit
48a0a6c7e3
@ -202,10 +202,6 @@ export class Common {
|
|||||||
|
|
||||||
/** Decodes a channel id returned by lnd as uint64 to a short channel id */
|
/** Decodes a channel id returned by lnd as uint64 to a short channel id */
|
||||||
static channelIntegerIdToShortId(id: string): string {
|
static channelIntegerIdToShortId(id: string): string {
|
||||||
if (config.LIGHTNING.BACKEND === 'cln') {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
const n = BigInt(id);
|
const n = BigInt(id);
|
||||||
return [
|
return [
|
||||||
n >> 40n, // nth block
|
n >> 40n, // nth block
|
||||||
|
@ -420,7 +420,7 @@ class ChannelsApi {
|
|||||||
const result = await DB.query<ResultSetHeader>(`
|
const result = await DB.query<ResultSetHeader>(`
|
||||||
UPDATE channels
|
UPDATE channels
|
||||||
SET status = 0
|
SET status = 0
|
||||||
WHERE short_id NOT IN (
|
WHERE id NOT IN (
|
||||||
${graphChannelsIds.map(id => `"${id}"`).join(',')}
|
${graphChannelsIds.map(id => `"${id}"`).join(',')}
|
||||||
)
|
)
|
||||||
AND status != 2
|
AND status != 2
|
||||||
|
@ -90,7 +90,7 @@ async function buildFullChannel(clChannelA: any, clChannelB: any): Promise<ILigh
|
|||||||
const outputIdx = parts[2];
|
const outputIdx = parts[2];
|
||||||
|
|
||||||
return {
|
return {
|
||||||
channel_id: clChannelA.short_channel_id,
|
channel_id: convertChannelId(clChannelA.short_channel_id),
|
||||||
capacity: clChannelA.satoshis,
|
capacity: clChannelA.satoshis,
|
||||||
last_update: lastUpdate,
|
last_update: lastUpdate,
|
||||||
node1_policy: convertPolicy(clChannelA),
|
node1_policy: convertPolicy(clChannelA),
|
||||||
@ -111,7 +111,7 @@ async function buildIncompleteChannel(clChannel: any): Promise<ILightningApi.Cha
|
|||||||
const outputIdx = parts[2];
|
const outputIdx = parts[2];
|
||||||
|
|
||||||
return {
|
return {
|
||||||
channel_id: clChannel.short_channel_id,
|
channel_id: convertChannelId(clChannel.short_channel_id),
|
||||||
capacity: clChannel.satoshis,
|
capacity: clChannel.satoshis,
|
||||||
last_update: clChannel.last_update ?? 0,
|
last_update: clChannel.last_update ?? 0,
|
||||||
node1_policy: convertPolicy(clChannel),
|
node1_policy: convertPolicy(clChannel),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user