Adding channel id in addition to short id

This commit is contained in:
softsimon committed 2022-07-08 18:55:22 +02:00
1 parent 7e1c2f4f40
commit b0b73e6c70
5 files changed
+36 -4

No files matched your search

@@ -1,4 +1,4 @@
import { chanNumber } from 'bolt07';
import DB from '../database';
import logger from '../logger';
import lightningApi from '../api/lightning/lightning-api-factory';
@@ -71,11 +71,14 @@ class NodeSyncService {
}
private async $saveChannel(channel: ILightningApi.Channel): Promise<void> {
const fromChannel = chanNumber({ channel: channel.id }).number;
try {
const d = new Date(Date.parse(channel.updated_at));
const query = `INSERT INTO channels
(
id,
short_id,
capacity,
transaction_id,
transaction_vout,
@@ -98,7 +101,7 @@ class NodeSyncService {
node2_min_htlc_mtokens,
node2_updated_at
)
VALUES (?, ?, ?, ?, ?, 1, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
VALUES (?, ?, ?, ?, ?, ?, 1, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
ON DUPLICATE KEY UPDATE
capacity = ?,
updated_at = ?,
@@ -122,6 +125,7 @@ class NodeSyncService {
;`;
await DB.query(query, [
fromChannel,
channel.id,
channel.capacity,
channel.transaction_id,