ln-service 56.6.0 → 56.7.1

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,14 @@
1
1
  # Versions
2
2
 
3
+ ## 56.7.1
4
+
5
+ - `isDestinationPayable`: Correct behavior for passing variations of amounts
6
+
7
+ ## 56.7.0
8
+
9
+ - `getPendingChannels`: Add `description` to return pending channel description
10
+ - `getPendingChannels`: Add `is_private` to show pending channel announcement
11
+
3
12
  ## 56.6.0
4
13
 
5
14
  - `getPendingChannels`: Add `type` to return pending channel type
package/README.md CHANGED
@@ -1684,7 +1684,7 @@ Requires `offchain:read` permission
1684
1684
 
1685
1685
  `is_trusted_funding` is not supported on LND 0.15.0 and below
1686
1686
 
1687
- `description` is not supported on LND 0.16.3 and below
1687
+ `description` is not supported on LND 0.16.4 and below
1688
1688
 
1689
1689
  {
1690
1690
  [is_active]: <Limit Results To Only Active Channels Bool> // false
@@ -2881,6 +2881,10 @@ channel may be opening, closing, or active.
2881
2881
 
2882
2882
  Requires `offchain:read` permission
2883
2883
 
2884
+ `is_private` is not supported in LND 0.14.5 or before
2885
+
2886
+ `description` is not supported in LND 0.16.4 or before
2887
+
2884
2888
  {
2885
2889
  lnd: <Authenticated LND API Object>
2886
2890
  }
@@ -2890,10 +2894,12 @@ Requires `offchain:read` permission
2890
2894
  pending_channels: [{
2891
2895
  capacity: <Channel Capacity Tokens Number>
2892
2896
  [close_transaction_id]: <Channel Closing Transaction Id String>
2897
+ [description]: <Channel Description String>
2893
2898
  is_active: <Channel Is Active Bool>
2894
2899
  is_closing: <Channel Is Closing Bool>
2895
2900
  is_opening: <Channel Is Opening Bool>
2896
2901
  [is_partner_initiated]: <Channel Partner Initiated Channel Bool>
2902
+ [is_private]: <Channel Is Private Bool>
2897
2903
  is_timelocked: <Channel Local Funds Constrained by Timelock Script Bool>
2898
2904
  local_balance: <Channel Local Tokens Balance Number>
2899
2905
  local_reserve: <Channel Local Reserved Tokens Number>
@@ -3702,9 +3708,9 @@ Requires `offchain:write`, `onchain:write`, `peers:write` permissions
3702
3708
  `base_fee_mtokens` is not supported on LND 0.15.5 and below
3703
3709
  `fee_rate` is not supported on LND 0.15.5 and below
3704
3710
 
3705
- `is_max_funding` is not supported on LND 0.16.3 and below
3711
+ `is_max_funding` is not supported on LND 0.16.4 and below
3706
3712
 
3707
- `description` is not supported on LND 0.16.3 and below
3713
+ `description` is not supported on LND 0.16.4 and below
3708
3714
 
3709
3715
  {
3710
3716
  [base_fee_mtokens]: <Routing Base Fee Millitokens Charged String>
@@ -3761,7 +3767,7 @@ as well as a channel open request listener to accept the trusted funding.
3761
3767
  `base_fee_mtokens` is not supported on LND 0.15.5 and below
3762
3768
  `fee_rate` is not supported on LND 0.15.5 and below
3763
3769
 
3764
- `description` is not supported on LND 0.16.3 and below
3770
+ `description` is not supported on LND 0.16.4 and below
3765
3771
 
3766
3772
  {
3767
3773
  channels: [{
@@ -4394,7 +4400,7 @@ Requires `address:read`, `offchain:write`, `onchain:write` permissions
4394
4400
 
4395
4401
  Requires LND compiled with `walletrpc` build tag
4396
4402
 
4397
- `description` is not supported on LND 0.16.3 and below
4403
+ `description` is not supported on LND 0.16.4 and below
4398
4404
 
4399
4405
  {
4400
4406
  capacity: <Channel Capacity Tokens Number>
@@ -5264,7 +5270,7 @@ Requires `offchain:read` permission
5264
5270
 
5265
5271
  `is_trusted_funding`, `other_ids` are not supported on LND 0.15.0 and below
5266
5272
 
5267
- `description` is not supported on LND 0.16.3 and below
5273
+ `description` is not supported on LND 0.16.4 and below
5268
5274
 
5269
5275
  {
5270
5276
  lnd: <Authenticated LND API Object>
@@ -6806,7 +6812,7 @@ LND must be running with "RPC middleware" enabled: `rpcmiddleware.enable=1`
6806
6812
 
6807
6813
  This method is not supported in LND 0.13.4 and below
6808
6814
 
6809
- `description` is not supported on LND 0.16.3 and below
6815
+ `description` is not supported on LND 0.16.4 and below
6810
6816
 
6811
6817
  {
6812
6818
  [id]: <RPC Middleware Interception Name String>
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "cors": "2.8.5",
12
12
  "express": "4.18.2",
13
13
  "invoices": "2.2.3",
14
- "lightning": "9.6.0",
14
+ "lightning": "9.7.1",
15
15
  "macaroon": "3.0.4",
16
16
  "morgan": "1.10.0",
17
17
  "ws": "8.13.0"
@@ -29,7 +29,7 @@
29
29
  "bn.js": "5.2.1",
30
30
  "bs58check": "3.0.1",
31
31
  "ecpair": "2.1.0",
32
- "ln-docker-daemons": "5.0.5",
32
+ "ln-docker-daemons": "5.0.6",
33
33
  "p2tr": "1.3.3",
34
34
  "portfinder": "1.0.32",
35
35
  "psbt": "2.7.2",
@@ -69,5 +69,5 @@
69
69
  "integration-test-0.14.4": "DOCKER_LND_VERSION=v0.14.4-beta npm run test",
70
70
  "test": "echo $DOCKER_LND_VERSION && tap -j 2 --branches=1 --functions=1 --lines=1 --statements=1 -t 200 test/autopilotrpc-integration/*.js test/chainrpc-integration/*.js test/integration/*.js test/invoicesrpc-integration/*.js test/peersrpc-integration/*.js test/routerrpc-integration/*.js test/signerrpc-integration/*.js test/tower_clientrpc-integration/*.js test/tower_serverrpc-integration/*.js test/walletrpc-integration/*.js"
71
71
  },
72
- "version": "56.6.0"
72
+ "version": "56.7.1"
73
73
  }
@@ -27,6 +27,7 @@ const {unlockUtxo} = require('./../../');
27
27
 
28
28
  const capacity = 1e6;
29
29
  const count = 100;
30
+ const description = 'description';
30
31
  const interval = 100;
31
32
  const race = promises => Promise.race(promises);
32
33
  const size = 3;
@@ -61,11 +62,16 @@ test(`Forfeit pending channel`, async ({end, equal, strictSame}) => {
61
62
  return await addPeer({lnd, public_key: node.id, socket: node.socket});
62
63
  });
63
64
 
64
- const channels = [{capacity, partner_public_key: target.id}];
65
+ const channels = [{
66
+ capacity,
67
+ description,
68
+ is_private: true,
69
+ partner_public_key: target.id,
70
+ }];
65
71
 
66
72
  // Propose a channel to target
67
- const proposeToTarget = await asyncRetry({interval, times}, cbk => {
68
- return asyncTimeout(openChannels, 1000 * 10)({
73
+ const proposeToTarget = await asyncRetry({interval: 1000, times}, cbk => {
74
+ return asyncTimeout(openChannels, 1000 * 3)({
69
75
  channels,
70
76
  lnd,
71
77
  is_avoiding_broadcast: true,
@@ -96,10 +102,15 @@ test(`Forfeit pending channel`, async ({end, equal, strictSame}) => {
96
102
  });
97
103
 
98
104
  // Propose a channel to remote
99
- const proposeToRemote = await asyncRetry({interval, times}, cbk => {
100
- return asyncTimeout(openChannels, 1000 * 10)({
105
+ const proposeToRemote = await asyncRetry({interval: 1000, times}, cbk => {
106
+ return asyncTimeout(openChannels, 1000 * 3)({
101
107
  lnd,
102
- channels: [{capacity, partner_public_key: remote.id}],
108
+ channels: [{
109
+ capacity,
110
+ description,
111
+ is_private: true,
112
+ partner_public_key: remote.id,
113
+ }],
103
114
  is_avoiding_broadcast: true,
104
115
  },
105
116
  cbk);
@@ -122,13 +133,18 @@ test(`Forfeit pending channel`, async ({end, equal, strictSame}) => {
122
133
  funding: signRemote.psbt,
123
134
  });
124
135
 
136
+ await delay(1000);
137
+
125
138
  const {transaction} = extractTransaction({ecp, psbt: signRemote.psbt});
126
139
 
127
140
  await broadcastChainTransaction({lnd, transaction});
128
141
 
129
- const channel = await asyncRetry({interval, times}, async () => {
142
+ await generate({});
143
+
144
+ const channel = await asyncRetry({interval: 1000, times}, async () => {
130
145
  const [channel] = (await getChannels({lnd})).channels;
131
146
 
147
+ // Exit early when the channel is created
132
148
  if (!!channel) {
133
149
  return channel;
134
150
  }
@@ -142,6 +158,12 @@ test(`Forfeit pending channel`, async ({end, equal, strictSame}) => {
142
158
 
143
159
  const [pending] = (await getPendingChannels({lnd})).pending_channels;
144
160
 
161
+ // Description is not supported in LND 0.16.4 or before
162
+ if (!!pending.description) {
163
+ strictSame(pending.description, description, 'Got expected description');
164
+ strictSame(pending.is_private, true, 'Got pending private status');
165
+ }
166
+
145
167
  const stuckTx = extractTransaction({ecp, psbt: signTarget.psbt});
146
168
 
147
169
  const [stuckPending] = proposeToTarget.pending;
@@ -107,7 +107,7 @@ test('Subscribe to channels', async ({end, equal, fail}) => {
107
107
  equal(openEvent.local_balance, 890950, 'Channel local balance returned');
108
108
  }
109
109
 
110
- // LND 0.16.3 and below do not support channel descriptions
110
+ // LND 0.16.4 and below do not support channel descriptions
111
111
  if (!!openEvent.description) {
112
112
  equal(openEvent.description, description, 'Got channel open description');
113
113
  }
@@ -121,7 +121,6 @@ test('Subscribe to channels', async ({end, equal, fail, strictSame}) => {
121
121
  return;
122
122
  });
123
123
 
124
-
125
124
  const gotControl = nodeUpdated.find(n => n.public_key === control.id);
126
125
 
127
126
  const expectedControl = {
@@ -0,0 +1,45 @@
1
+ const {setupChannel} = require('ln-docker-daemons');
2
+ const {spawnLightningCluster} = require('ln-docker-daemons');
3
+ const {test} = require('@alexbosworth/tap');
4
+
5
+ const {isDestinationPayable} = require('./../../');
6
+
7
+ const size = 2;
8
+ const tokens = 1e6 / 2;
9
+
10
+ // Determining if a route is payable should indicate if a route can be found
11
+ test('Is destination payable', async ({end, equal, strictSame}) => {
12
+ const {kill, nodes} = await spawnLightningCluster({size});
13
+
14
+ const [{generate, lnd}, target] = nodes;
15
+
16
+ try {
17
+ await setupChannel({generate, lnd, to: target});
18
+
19
+ const canPay = await isDestinationPayable({lnd, destination: target.id});
20
+
21
+ strictSame(canPay, {is_payable: true}, 'Can pay with default amount');
22
+
23
+ const canPayTokens = await isDestinationPayable({
24
+ lnd,
25
+ tokens,
26
+ destination: target.id,
27
+ });
28
+
29
+ strictSame(canPayTokens, {is_payable: true}, 'Can pay with tokens amount');
30
+
31
+ const canPayMtokens = await isDestinationPayable({
32
+ lnd,
33
+ mtokens: tokens,
34
+ destination: target.id,
35
+ });
36
+
37
+ strictSame(canPayMtokens, {is_payable: true}, 'Can pay with mtokens sum');
38
+ } catch (err) {
39
+ equal(err, null, 'Expected no error');
40
+ } finally {
41
+ await kill({});
42
+ }
43
+
44
+ return end();
45
+ });