balanceofsatoshis 18.2.5 → 18.2.7

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,6 +1,6 @@
1
1
  # Versions
2
2
 
3
- ## 18.2.5
3
+ ## 18.2.7
4
4
 
5
5
  - `graph`: represent inbound fees in policy display
6
6
  - `rebalance`: fix support for 0.18.0 inbound fees
package/package.json CHANGED
@@ -24,25 +24,25 @@
24
24
  "bitcoinjs-lib": "6.1.6",
25
25
  "bolt01": "2.0.0",
26
26
  "bolt03": "1.3.2",
27
- "bolt07": "1.9.3",
27
+ "bolt07": "1.9.4",
28
28
  "cbor": "9.0.2",
29
29
  "colorette": "2.0.20",
30
30
  "crypto-js": "4.2.0",
31
31
  "csv-parse": "5.5.6",
32
32
  "ecpair": "2.1.0",
33
- "goldengate": "14.0.5",
33
+ "goldengate": "14.0.7",
34
34
  "grammy": "1.24.1",
35
35
  "hot-formula-parser": "4.0.0",
36
36
  "import-lazy": "4.0.0",
37
37
  "ini": "4.1.3",
38
38
  "inquirer": "9.2.23",
39
- "ln-accounting": "8.0.1",
40
- "ln-service": "57.14.1",
41
- "ln-sync": "6.0.3",
42
- "ln-telegram": "6.1.4",
39
+ "ln-accounting": "8.0.3",
40
+ "ln-service": "57.14.3",
41
+ "ln-sync": "6.0.4",
42
+ "ln-telegram": "6.1.6",
43
43
  "moment": "2.30.1",
44
- "paid-services": "6.1.3",
45
- "probing": "5.0.1",
44
+ "paid-services": "6.1.4",
45
+ "probing": "5.0.2",
46
46
  "psbt": "3.0.0",
47
47
  "qrcode-terminal": "0.12.0",
48
48
  "sanitize-filename": "1.6.3",
@@ -54,7 +54,7 @@
54
54
  "description": "Lightning balance CLI",
55
55
  "devDependencies": {
56
56
  "invoices": "3.0.0",
57
- "ln-docker-daemons": "6.0.18",
57
+ "ln-docker-daemons": "6.0.19",
58
58
  "mock-lnd": "1.4.4"
59
59
  },
60
60
  "engines": {
@@ -82,5 +82,5 @@
82
82
  "postpublish": "docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t alexbosworth/balanceofsatoshis -t alexbosworth/balanceofsatoshis:$npm_package_version --push .",
83
83
  "test": "npx nyc@15.1.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"
84
84
  },
85
- "version": "18.2.5"
85
+ "version": "18.2.7"
86
86
  }
@@ -10,7 +10,6 @@ const {getHeight} = require('ln-service');
10
10
  const {getIdentity} = require('ln-service');
11
11
  const {getNode} = require('ln-service');
12
12
  const {getPeerLiquidity} = require('ln-sync');
13
- const {getRouteThroughHops} = require('ln-service');
14
13
  const {getWalletVersion} = require('ln-service');
15
14
  const {parseAmount} = require('ln-accounting');
16
15
  const {payViaRoutes} = require('ln-service');
@@ -697,59 +696,17 @@ module.exports = (args, cbk) => {
697
696
  // Get the current height
698
697
  getHeight: ['channels', 'lnd', ({lnd}, cbk) => getHeight({lnd}, cbk)],
699
698
 
700
- // Get route for rebalance
701
- getRoute: ['channels', 'invoice', ({channels, invoice}, cbk) => {
702
- // Find any inbound policy, LND 0.18.0 miscalculates fees here
703
- const hasInboundPolicy = channels.find(channel => {
704
- return channel.policies.find(policy => {
705
- if (policy.inbound_base_discount_mtokens !== '0') {
706
- return true;
707
- }
708
-
709
- if (policy.inbound_rate_discount !== 0) {
710
- return true;
711
- }
712
-
713
- return false;
714
- });
715
- });
716
-
717
- // Exit early when there is an inbound fee that needs a recalc
718
- if (!!hasInboundPolicy) {
719
- return cbk(null, {});
720
- }
721
-
722
- return getRouteThroughHops({
723
- cltv_delta: cltvDelta,
724
- lnd: args.lnd,
725
- mtokens: invoice.mtokens,
726
- payment: invoice.payment,
727
- public_keys: channels.map(n => n.destination),
728
- total_mtokens: !!invoice.payment ? invoice.mtokens : undefined,
729
- },
730
- (err, res) => {
731
- // Exit early when there is an error and use local route calculation
732
- if (!!err) {
733
- return cbk(null, {});
734
- }
735
-
736
- return cbk(null, {route: res.route});
737
- });
738
- }],
739
-
740
699
  // Calculate route for rebalance
741
700
  routes: [
742
701
  'channels',
743
702
  'getHeight',
744
703
  'getPublicKey',
745
- 'getRoute',
746
704
  'invoice',
747
705
  'tokens',
748
706
  ({
749
707
  channels,
750
708
  getHeight,
751
709
  getPublicKey,
752
- getRoute,
753
710
  invoice,
754
711
  tokens,
755
712
  },
@@ -766,16 +723,15 @@ module.exports = (args, cbk) => {
766
723
  total_mtokens: !!invoice.payment ? invoice.mtokens : undefined,
767
724
  });
768
725
 
769
- const endRoute = getRoute.route || route;
770
726
  const maxFee = args.max_fee || defaultMaxFee;
771
727
  const maxFeeRate = args.max_fee_rate || defaultMaxFeeRate;
772
728
 
773
- if (endRoute.tokens < minRebalanceAmount) {
729
+ if (route.tokens < minRebalanceAmount) {
774
730
  return cbk([503, 'EncounteredUnexpectedRouteLiquidityFailure']);
775
731
  }
776
732
 
777
733
  const [highFeeAt] = sortBy({
778
- array: endRoute.hops.map(hop => ({
734
+ array: route.hops.map(hop => ({
779
735
  to: hop.public_key,
780
736
  fee: hop.fee,
781
737
  })),
@@ -783,15 +739,15 @@ module.exports = (args, cbk) => {
783
739
  }).sorted.reverse().map(n => n.to);
784
740
 
785
741
  // Exit early when a max fee is specified and exceeded
786
- if (!!maxFee && endRoute.fee > maxFee) {
742
+ if (!!maxFee && route.fee > maxFee) {
787
743
  return cbk([
788
744
  400,
789
745
  'RebalanceTotalFeeTooHigh',
790
- {needed_max_fee: endRoute.fee.toString(), high_fee: highFeeAt},
746
+ {needed_max_fee: route.fee.toString(), high_fee: highFeeAt},
791
747
  ]);
792
748
  }
793
749
 
794
- const feeRate = ceil(endRoute.fee / endRoute.tokens * rateDivisor);
750
+ const feeRate = ceil(route.fee / route.tokens * rateDivisor);
795
751
 
796
752
  // Exit early when the max fee rate is specified and exceeded
797
753
  if (!!maxFeeRate && feeRate > maxFeeRate) {
@@ -802,7 +758,7 @@ module.exports = (args, cbk) => {
802
758
  ]);
803
759
  }
804
760
 
805
- return cbk(null, [endRoute]);
761
+ return cbk(null, [route]);
806
762
  } catch (err) {
807
763
  return cbk([500, 'FailedToConstructRebalanceRoute', {err}]);
808
764
  }