Skip to content

Commit 6c7b64e

Browse files
authored
Merge pull request #243 from synonymdev/lsp-event
feat: append channel monitor details to lsp log
2 parents c42e73e + d8623b0 commit 6c7b64e

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

lib/src/lightning-manager.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ import {
5757
IAddress,
5858
TLspLogPayload,
5959
TLspLogEvent,
60+
TChannelMonitor,
6061
} from './utils/types';
6162
import {
6263
appendPath,
@@ -1988,10 +1989,6 @@ class LightningManager {
19881989
(p) => p.payment_hash === res.payment_hash,
19891990
);
19901991

1991-
console.error(
1992-
`Existing claimed payments: ${JSON.stringify(existingClaimedPayment)}`,
1993-
);
1994-
19951992
if (
19961993
existingClaimedPayment &&
19971994
existingClaimedPayment.state === 'successful'
@@ -2248,14 +2245,23 @@ class LightningManager {
22482245
await this.syncLdk();
22492246
}
22502247

2251-
private async onLspLogEvent(payload: any): Promise<void> {
2248+
private async onLspLogEvent(payload: object): Promise<void> {
22522249
if (!this.lspLogEvent) {
22532250
return;
22542251
}
2252+
let body: { channelClose: object; channelFiles: TChannelMonitor[] } = {
2253+
channelClose: payload,
2254+
channelFiles: [],
2255+
};
22552256
const nodeIdRes = await ldk.nodeId();
22562257

2258+
const channelFiles = await ldk.listChannelMonitors(true);
2259+
if (channelFiles.isOk()) {
2260+
body.channelFiles = channelFiles.value;
2261+
}
2262+
22572263
await this.lspLogEvent({
2258-
body: JSON.stringify(payload),
2264+
body: JSON.stringify(body),
22592265
nodeId: nodeIdRes.isOk() ? nodeIdRes.value : '',
22602266
});
22612267
}

0 commit comments

Comments
 (0)