balanceofsatoshis 19.3.3 → 19.3.5

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Versions
2
2
 
3
+ ## 19.3.5
4
+
5
+ - Probing at low local balance value channels now corrects for fee buffer
6
+
3
7
  ## 19.3.3
4
8
 
5
9
  - Add support for LND 0.18.3
@@ -28,8 +28,10 @@ const defaultMaxFee = 1337;
28
28
  const defaultTokens = 1;
29
29
  const featureTypeChannelType = 45;
30
30
  const featureTypeTrustedFunding = 51;
31
+ const feeBuffer = fees => fees * 2;
31
32
  const {floor} = Math;
32
33
  const fromKeyType = '34349339';
34
+ const htlcOutputSize = 43;
33
35
  const keySendPreimageType = '5482373484';
34
36
  const makeNonce = () => randomBytes(32).toString('hex');
35
37
  const {max} = Math;
@@ -38,6 +40,7 @@ const {min} = Math;
38
40
  const nodeKeyFamily = 6;
39
41
  const preimageByteLength = 32;
40
42
  const {now} = Date;
43
+ const rate = n => n.commit_transaction_fee / (n.commit_transaction_weight / 4);
41
44
  const reserveRatio = 0.01;
42
45
  const signatureType = '34349337';
43
46
  const tokAsMtok = tokens => (BigInt(tokens || 0) * BigInt(1e3)).toString();
@@ -346,9 +349,10 @@ module.exports = (args, cbk) => {
346
349
  }
347
350
 
348
351
  const withBalance = withPeer.filter(n => {
352
+ const fees = n.commit_transaction_fee + (htlcOutputSize * rate(n));
349
353
  const reserve = n.local_reserve || floor(n.capacity * reserveRatio);
350
354
 
351
- return n.local_balance - tokens > reserve + n.commit_transaction_fee;
355
+ return n.local_balance - tokens > reserve + feeBuffer(fees);
352
356
  });
353
357
 
354
358
  if (!withBalance.length) {
package/package.json CHANGED
@@ -35,14 +35,14 @@
35
35
  "hot-formula-parser": "4.0.0",
36
36
  "import-lazy": "4.0.0",
37
37
  "ini": "5.0.0",
38
- "inquirer": "10.2.2",
38
+ "inquirer": "11.1.0",
39
39
  "ln-accounting": "8.0.4",
40
40
  "ln-service": "57.20.2",
41
41
  "ln-sync": "6.4.0",
42
- "ln-telegram": "6.1.7",
42
+ "ln-telegram": "6.1.8",
43
43
  "minimist": "1.2.8",
44
44
  "moment": "2.30.1",
45
- "paid-services": "6.1.5",
45
+ "paid-services": "6.1.6",
46
46
  "probing": "5.0.3",
47
47
  "psbt": "3.0.0",
48
48
  "qrcode-terminal": "0.12.0",
@@ -83,5 +83,5 @@
83
83
  "postpublish": "docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t alexbosworth/balanceofsatoshis -t alexbosworth/balanceofsatoshis:$npm_package_version --push .",
84
84
  "test": "npx nyc@17.0.0 node --experimental-test-coverage --test test/arrays/*.js test/balances/*.js test/chain/*.js test/display/*.js test/encryption/*.js test/lnd/*.js test/network/*.js test/nodes/*.js test/peers/*.js test/responses/*.js test/routing/*.js test/services/*.js test/swaps/*.js test/tags/*.js test/telegram/*.js test/wallets/*.js"
85
85
  },
86
- "version": "19.3.3"
86
+ "version": "19.3.5"
87
87
  }