From 3ad65f801d05bf47bf922a96dcefd1584b86b2f4 Mon Sep 17 00:00:00 2001 From: Jason Date: Fri, 24 May 2024 12:38:01 +0200 Subject: [PATCH 1/2] feat: append channel monitor details to lsp log --- lib/src/lightning-manager.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/src/lightning-manager.ts b/lib/src/lightning-manager.ts index 0f7a2e89..59c70668 100644 --- a/lib/src/lightning-manager.ts +++ b/lib/src/lightning-manager.ts @@ -57,6 +57,7 @@ import { IAddress, TLspLogPayload, TLspLogEvent, + TChannelMonitor, } from './utils/types'; import { appendPath, @@ -2248,14 +2249,23 @@ class LightningManager { await this.syncLdk(); } - private async onLspLogEvent(payload: any): Promise { + private async onLspLogEvent(payload: object): Promise { if (!this.lspLogEvent) { return; } + let body: { channelClose: object; channelFiles: TChannelMonitor[] } = { + channelClose: payload, + channelFiles: [], + }; const nodeIdRes = await ldk.nodeId(); + const channelFiles = await ldk.listChannelMonitors(true); + if (channelFiles.isOk()) { + body.channelFiles = channelFiles.value; + } + await this.lspLogEvent({ - body: JSON.stringify(payload), + body: JSON.stringify(body), nodeId: nodeIdRes.isOk() ? nodeIdRes.value : '', }); } From d8623b09750d89885b9e5521e1ea99c38c8bb74c Mon Sep 17 00:00:00 2001 From: Jason Date: Fri, 24 May 2024 14:59:45 +0200 Subject: [PATCH 2/2] fix: remove log --- lib/src/lightning-manager.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/src/lightning-manager.ts b/lib/src/lightning-manager.ts index 59c70668..31ce8713 100644 --- a/lib/src/lightning-manager.ts +++ b/lib/src/lightning-manager.ts @@ -1989,10 +1989,6 @@ class LightningManager { (p) => p.payment_hash === res.payment_hash, ); - console.error( - `Existing claimed payments: ${JSON.stringify(existingClaimedPayment)}`, - ); - if ( existingClaimedPayment && existingClaimedPayment.state === 'successful'