lnlink-server 1.1.3 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  {
2
- "buildTime": "2026-02-10T06:14:56.921Z",
2
+ "buildTime": "2026-02-10T06:57:44.837Z",
3
3
  "mode": "development",
4
4
  "bundle": "single",
5
5
  "external": "all",
package/dist/index.js CHANGED
@@ -2773,7 +2773,7 @@ var require_getConfig = __commonJS({
2773
2773
  });
2774
2774
  }
2775
2775
  __name(isPortAvailable, "isPortAvailable");
2776
- async function findAvailablePort(basePort) {
2776
+ async function findAvailablePort(basePort, assignedPorts = /* @__PURE__ */ new Set()) {
2777
2777
  const portRanges = {
2778
2778
  10009: [10009, 20009, 30009, 40009, 50009],
2779
2779
  // LINK_LND_RPC_PORT: 10009 -> 20009 -> 30009...
@@ -2792,13 +2792,13 @@ var require_getConfig = __commonJS({
2792
2792
  };
2793
2793
  if (portRanges[basePort]) {
2794
2794
  for (const port2 of portRanges[basePort]) {
2795
- if (await isPortAvailable(port2)) {
2795
+ if (!assignedPorts.has(port2) && await isPortAvailable(port2)) {
2796
2796
  return port2;
2797
2797
  }
2798
2798
  }
2799
2799
  let port = portRanges[basePort][portRanges[basePort].length - 1] + 1;
2800
2800
  while (port < 65535) {
2801
- if (await isPortAvailable(port)) {
2801
+ if (!assignedPorts.has(port) && await isPortAvailable(port)) {
2802
2802
  return port;
2803
2803
  }
2804
2804
  port++;
@@ -2806,7 +2806,7 @@ var require_getConfig = __commonJS({
2806
2806
  } else {
2807
2807
  let port = basePort;
2808
2808
  while (port < 65535) {
2809
- if (await isPortAvailable(port)) {
2809
+ if (!assignedPorts.has(port) && await isPortAvailable(port)) {
2810
2810
  return port;
2811
2811
  }
2812
2812
  port++;
@@ -2826,16 +2826,18 @@ var require_getConfig = __commonJS({
2826
2826
  "LINK_HTTP_PORT"
2827
2827
  ];
2828
2828
  const updatedConfig = { ...config };
2829
+ const assignedPorts = /* @__PURE__ */ new Set();
2829
2830
  for (const key of portKeys) {
2830
2831
  if (updatedConfig[key]) {
2831
2832
  const basePort = Number.parseInt(updatedConfig[key]);
2832
2833
  if (!Number.isNaN(basePort)) {
2833
2834
  try {
2834
- const availablePort = await findAvailablePort(basePort);
2835
+ const availablePort = await findAvailablePort(basePort, assignedPorts);
2835
2836
  if (availablePort !== basePort) {
2836
2837
  console.log(`[port-assign] Port ${basePort} for ${key} is occupied, using ${availablePort} instead`);
2837
2838
  updatedConfig[key] = availablePort;
2838
2839
  }
2840
+ assignedPorts.add(availablePort);
2839
2841
  } catch (error) {
2840
2842
  console.warn(`[port-assign] Failed to find available port for ${key}: ${error?.message}`);
2841
2843
  }
@@ -7179,7 +7181,7 @@ var require_package = __commonJS({
7179
7181
  "package.json"(exports2, module2) {
7180
7182
  module2.exports = {
7181
7183
  name: "lnlink-server",
7182
- version: "1.1.3",
7184
+ version: "1.1.4",
7183
7185
  private: false,
7184
7186
  main: "dist/index.js",
7185
7187
  files: [
@@ -8016,6 +8018,10 @@ var require_lndService = __commonJS({
8016
8018
  cipher_seed_mnemonic: seed
8017
8019
  });
8018
8020
  linkCache.set("tempPassword", password);
8021
+ try {
8022
+ await getWalletState(false);
8023
+ } catch (_refreshErr) {
8024
+ }
8019
8025
  const cipherSeedMnemonic = linkCache.get("cipherSeedMnemonic");
8020
8026
  const ret = {
8021
8027
  message: "Init wallet success.",
@@ -8149,6 +8155,10 @@ var require_lndService = __commonJS({
8149
8155
  });
8150
8156
  setCacheMacaroon(decodeWalletPassword);
8151
8157
  linkCache.set("tempPassword", wallet_password);
8158
+ try {
8159
+ await getWalletState(false);
8160
+ } catch (_refreshErr) {
8161
+ }
8152
8162
  }
8153
8163
  const ret = {
8154
8164
  msg: "Unlock success."