[lightning] unique sockets for ln nodes

This commit is contained in:
nymkappa 2024-04-19 10:56:15 +02:00
parent 5b19ffd524
commit ddfceddc57
No known key found for this signature in database
GPG Key ID: 92358FC85D9645DE

View File

@ -713,7 +713,9 @@ class NodesApi {
* Update node sockets
*/
public async $updateNodeSockets(publicKey: string, sockets: {network: string; addr: string}[]): Promise<void> {
const formattedSockets = (sockets.map(a => a.addr).join(',')) ?? '';
const uniqueAddr = [...new Set(sockets.map(a => a.addr))];
const formattedSockets = (uniqueAddr.join(',')) ?? '';
try {
await DB.query(`UPDATE nodes SET sockets = ? WHERE public_key = ?`, [formattedSockets, publicKey]);
} catch (e) {