Merge pull request #4991 from mempool/nymkappa/unique-node-addr

[lightning] unique sockets for ln nodes
This commit is contained in:
softsimon 2024-04-19 18:02:42 +07:00 committed by GitHub
commit bb44ed15da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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) {