ln-service 54.3.3 → 54.4.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,10 @@
1
1
  # Versions
2
2
 
3
+ ## 54.4.1
4
+
5
+ - `subscribeToRpcRequests`: `open_channel_request` add support for
6
+ `fee_rate`, `base_fee_mtokens`
7
+
3
8
  ## 54.3.3
4
9
 
5
10
  - `getWalletInfo`: Add support for LND 0.15.5
package/README.md CHANGED
@@ -6704,8 +6704,10 @@ This method is not supported in LND 0.13.4 and below
6704
6704
  macaroon: <Base64 Encoded Macaroon String>
6705
6705
  reject: ({message: <Rejection String>}, [cbk]) => {}
6706
6706
  request: {
6707
+ [base_fee_mtokens]: <Routing Base Fee Millitokens Charged String>
6707
6708
  [chain_fee_tokens_per_vbyte]: <Chain Fee Tokens Per VByte Number>
6708
6709
  [cooperative_close_address]: <Prefer Cooperative Close To Address String>
6710
+ [fee_rate]: <Routing Fee Rate In Millitokens Per Million Number>
6709
6711
  [give_tokens]: <Tokens to Gift To Partner Number>
6710
6712
  [is_private]: <Channel is Private Bool>
6711
6713
  local_tokens: <Local Tokens Number>
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.2",
14
- "lightning": "6.3.2",
14
+ "lightning": "6.4.1",
15
15
  "macaroon": "3.0.4",
16
16
  "morgan": "1.10.0",
17
17
  "ws": "8.11.0"
@@ -24,11 +24,11 @@
24
24
  "asyncjs-util": "1.2.10",
25
25
  "bip32": "3.1.0",
26
26
  "bip66": "1.1.5",
27
- "bitcoinjs-lib": "6.0.2",
27
+ "bitcoinjs-lib": "6.1.0",
28
28
  "bn.js": "5.2.1",
29
29
  "bs58check": "2.1.2",
30
30
  "ecpair": "2.1.0",
31
- "ln-docker-daemons": "3.1.6",
31
+ "ln-docker-daemons": "4.0.0",
32
32
  "p2tr": "1.3.2",
33
33
  "portfinder": "1.0.32",
34
34
  "psbt": "2.7.1",
@@ -62,7 +62,7 @@
62
62
  "integration-test-0.15.2": "DOCKER_LND_VERSION=v0.15.2-beta npm run test",
63
63
  "integration-test-0.14.5": "DOCKER_LND_VERSION=v0.14.5-beta npm run test",
64
64
  "integration-test-0.14.4": "DOCKER_LND_VERSION=v0.14.4-beta npm run test",
65
- "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/walletrpc-integration/*.js"
65
+ "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"
66
66
  },
67
- "version": "54.3.3"
67
+ "version": "54.4.1"
68
68
  }
@@ -14,7 +14,7 @@ const {subscribeToBlocks} = require('./../../');
14
14
  const {waitForTermination} = require('./../macros');
15
15
 
16
16
  const confirmationCount = 6;
17
- const interval = 10;
17
+ const interval = 50;
18
18
  const race = promises => Promise.race(promises);
19
19
  const times = 4000;
20
20
 
@@ -9,8 +9,10 @@ const {getForwards} = require('./../../');
9
9
  const {pay} = require('./../../');
10
10
  const {setupChannel} = require('./../macros');
11
11
 
12
+ const interval = 100;
12
13
  const limit = 1;
13
14
  const size = 3;
15
+ const times = 1000;
14
16
  const tokens = 100;
15
17
 
16
18
  // Getting forwarded payments should return all forwarded payments
@@ -32,7 +34,7 @@ test('Get forwards', async ({end, equal, strictSame}) => {
32
34
  await delay(2000);
33
35
 
34
36
  for (let i = 0, l = remote.lnd; i < 3; i++) {
35
- await asyncRetry({}, async () => {
37
+ await asyncRetry({interval, times}, async () => {
36
38
  await delay(1000);
37
39
 
38
40
  await pay({
@@ -34,6 +34,7 @@ test(`Recover funds from channel`, async ({end, equal}) => {
34
34
  generate_address: generateAddress,
35
35
  lightning_p2p_port: await getPort({port: 12001, stopPort: 13000}),
36
36
  lightning_rpc_port: await getPort({port: 13001, stopPort: 14000}),
37
+ lightning_tower_port: await getPort({port: 14001, stopPort: 15000}),
37
38
  });
38
39
  });
39
40
 
@@ -46,6 +47,7 @@ test(`Recover funds from channel`, async ({end, equal}) => {
46
47
  generate_address: generateAddress,
47
48
  lightning_p2p_port: await getPort({port: 12001, stopPort: 13000}),
48
49
  lightning_rpc_port: await getPort({port: 13001, stopPort: 14000}),
50
+ lightning_tower_port: await getPort({port: 14001, stopPort: 15000}),
49
51
  });
50
52
  });
51
53
 
@@ -116,6 +118,7 @@ test(`Recover funds from channel`, async ({end, equal}) => {
116
118
  generate_address: generateAddress,
117
119
  lightning_p2p_port: await getPort({port: 12001, stopPort: 13000}),
118
120
  lightning_rpc_port: await getPort({port: 13001, stopPort: 14000}),
121
+ lightning_tower_port: await getPort({port: 14001, stopPort: 15000}),
119
122
  });
120
123
  });
121
124
 
@@ -34,6 +34,7 @@ test(`Recover funds from channels`, async ({end, equal}) => {
34
34
  generate_address: generateAddress,
35
35
  lightning_p2p_port: await getPort({port: 12001, stopPort: 13000}),
36
36
  lightning_rpc_port: await getPort({port: 13001, stopPort: 14000}),
37
+ lightning_tower_port: await getPort({port: 14001, stopPort: 15000}),
37
38
  });
38
39
  });
39
40
 
@@ -46,6 +47,7 @@ test(`Recover funds from channels`, async ({end, equal}) => {
46
47
  generate_address: generateAddress,
47
48
  lightning_p2p_port: await getPort({port: 12001, stopPort: 13000}),
48
49
  lightning_rpc_port: await getPort({port: 13001, stopPort: 14000}),
50
+ lightning_tower_port: await getPort({port: 14001, stopPort: 15000}),
49
51
  });
50
52
  });
51
53
 
@@ -112,6 +114,7 @@ test(`Recover funds from channels`, async ({end, equal}) => {
112
114
  generate_address: generateAddress,
113
115
  lightning_p2p_port: await getPort({port: 12001, stopPort: 13000}),
114
116
  lightning_rpc_port: await getPort({port: 13001, stopPort: 14000}),
117
+ lightning_tower_port: await getPort({port: 14001, stopPort: 15000}),
115
118
  });
116
119
  });
117
120
 
@@ -6,6 +6,7 @@ const {createChainAddress} = require('./../../');
6
6
  const {getChainBalance} = require('./../../');
7
7
  const {sendToChainAddresses} = require('./../../');
8
8
 
9
+ const interval = 1000;
9
10
  const regtestBech32AddressHrp = 'bcrt';
10
11
  const size = 2;
11
12
  const times = 10;
@@ -47,7 +48,7 @@ test(`Send to chain address`, async ({end, equal}) => {
47
48
  equal(sent.is_outgoing, true, 'Transaction is outgoing');
48
49
  equal(sent.tokens, tokens, 'Tokens amount matches tokens sent');
49
50
 
50
- await asyncRetry({times}, async () => {
51
+ await asyncRetry({interval, times}, async () => {
51
52
  // Generate to confirm the tx
52
53
  await control.generate({});
53
54
 
@@ -143,6 +143,8 @@ test(`Subscribe to RPC requests`, async ({end, equal, fail, strictSame}) => {
143
143
  // Gift some tokens in a channel
144
144
  await openChannel({
145
145
  lnd,
146
+ base_fee_mtokens: '1',
147
+ fee_rate: 1,
146
148
  give_tokens: 1e5,
147
149
  local_tokens: 1e6,
148
150
  partner_public_key: Buffer.alloc(33, 2).toString('hex'),
@@ -85,13 +85,15 @@ test(`Open unconfirmed channels`, async ({end, equal, match, strictSame}) => {
85
85
  });
86
86
 
87
87
  // Propose the channel to the peer
88
- const {pending} = await openChannels({
89
- lnd,
90
- channels: [{
91
- capacity,
92
- is_trusted_funding: true,
93
- partner_public_key: target.id,
94
- }],
88
+ const {pending} = await asyncRetry({interval, times}, async () => {
89
+ return await openChannels({
90
+ lnd,
91
+ channels: [{
92
+ capacity,
93
+ is_trusted_funding: true,
94
+ partner_public_key: target.id,
95
+ }],
96
+ });
95
97
  });
96
98
 
97
99
  // Setup funding to the 2:2 output
@@ -0,0 +1,39 @@
1
+ const {connectWatchtower} = require('./../../');
2
+ const {getConnectedWatchtowers} = require('./../../');
3
+ const {getTowerServerInfo} = require('./../../');
4
+ const {spawnLightningCluster} = require('ln-docker-daemons');
5
+ const {test} = require('@alexbosworth/tap');
6
+
7
+ const conf = ['--watchtower.active', '--wtclient.active'];
8
+ const size = 2;
9
+
10
+ // Connecting to a watchtower should add a watchtower
11
+ test(`Connect watchtower`, async ({end, equal, fail, match}) => {
12
+ const {kill, nodes} = await spawnLightningCluster({
13
+ size,
14
+ lnd_configuration: conf
15
+ });
16
+
17
+ const [{lnd}, target] = nodes;
18
+
19
+ try {
20
+ const {tower} = await getTowerServerInfo({lnd: target.lnd});
21
+
22
+ const [socket] = tower.sockets;
23
+
24
+ await connectWatchtower({lnd, socket, public_key: tower.public_key});
25
+
26
+ const [watcher] = (await getConnectedWatchtowers({lnd})).towers;
27
+
28
+ equal(watcher.is_active, true, 'Tower is active');
29
+ equal(watcher.public_key, tower.public_key, 'Tower public key added');
30
+ equal(watcher.sessions.length, [].length, 'Tower has no sessions');
31
+ equal(watcher.sockets.pop(), socket, 'Tower at socket added');
32
+ } catch (err) {
33
+ equal(err, null, 'Expected no error');
34
+ }
35
+
36
+ await kill({});
37
+
38
+ return end();
39
+ });
@@ -0,0 +1,49 @@
1
+ const {connectWatchtower} = require('./../../');
2
+ const {getConnectedWatchtowers} = require('./../../');
3
+ const {getTowerServerInfo} = require('./../../');
4
+ const {spawnLightningCluster} = require('ln-docker-daemons');
5
+ const {test} = require('@alexbosworth/tap');
6
+
7
+ const conf = ['--watchtower.active', '--wtclient.active'];
8
+ const size = 2;
9
+
10
+ // Getting connected watchtowers should return watchtowers
11
+ test(`Get connected watchtowers`, async ({end, equal, fail, match}) => {
12
+ const {kill, nodes} = await spawnLightningCluster({
13
+ size,
14
+ lnd_configuration: conf
15
+ });
16
+
17
+ const [{lnd}, target] = nodes;
18
+
19
+ try {
20
+ const {tower} = await getTowerServerInfo({lnd: target.lnd});
21
+
22
+ const [socket] = tower.sockets;
23
+
24
+ await connectWatchtower({lnd, socket, public_key: tower.public_key});
25
+
26
+ const res = (await getConnectedWatchtowers({lnd}));
27
+
28
+ const [watcher] = res.towers;
29
+
30
+ equal(res.backups_count, 0, 'Got backups count');
31
+ equal(res.failed_backups_count, 0, 'Got failed backups count');
32
+ equal(res.finished_sessions_count, 0, 'Got finished sessions count');
33
+ equal(res.max_session_update_count, 1024, 'Got max session update count');
34
+ equal(res.pending_backups_count, 0, 'Got pending backups count');
35
+ equal(res.sessions_count, 0, 'Got sessions count');
36
+ equal(res.sweep_tokens_per_vbyte, 10, 'Got sweep tokens per vbyte');
37
+
38
+ equal(watcher.is_active, true, 'Tower is active');
39
+ equal(watcher.public_key, tower.public_key, 'Tower is connected');
40
+ equal(watcher.sessions.length, [].length, 'No sessions initiated');
41
+ equal(watcher.sockets.slice().pop(), socket, 'Tower socket returned');
42
+ } catch (err) {
43
+ equal(err, null, 'Expected no error');
44
+ }
45
+
46
+ await kill({});
47
+
48
+ return end();
49
+ });
@@ -1,16 +1,15 @@
1
+ const {spawnLightningCluster} = require('ln-docker-daemons');
1
2
  const {test} = require('@alexbosworth/tap');
2
3
 
3
4
  const {getTowerServerInfo} = require('./../../');
4
- const {spawnLnd} = require('./../macros');
5
- const {waitForTermination} = require('./../macros');
6
5
 
7
- const pubKeyHexLength = Buffer.alloc(33).toString('hex').length;
6
+ const conf = ['--watchtower.active'];
8
7
 
9
8
  // Getting the tower server info should return tower server info
10
9
  test(`Get tower server info`, async ({end, equal, match}) => {
11
- const spawned = await spawnLnd({tower: true});
10
+ const {kill, nodes} = await spawnLightningCluster({lnd_configuration: conf});
12
11
 
13
- const {lnd} = spawned;
12
+ const [{lnd}] = nodes;
14
13
 
15
14
  const {tower} = await getTowerServerInfo({lnd});
16
15
 
@@ -20,15 +19,13 @@ test(`Get tower server info`, async ({end, equal, match}) => {
20
19
 
21
20
  match(socket, /127.0.0.1\:\d\d\d\d/, 'Tower socket returned');
22
21
 
23
- equal(tower.public_key.length, pubKeyHexLength, 'Public key returned');
22
+ equal(tower.public_key.length, 66, 'Public key returned');
24
23
 
25
24
  const [uri] = tower.uris;
26
25
 
27
26
  equal(uri, `${tower.public_key}@${socket}`, 'Got back socket');
28
27
 
29
- spawned.kill();
30
-
31
- await waitForTermination({lnd});
28
+ await kill({});
32
29
 
33
30
  return end();
34
31
  });
@@ -1,43 +0,0 @@
1
- const {test} = require('@alexbosworth/tap');
2
-
3
- const {connectWatchtower} = require('./../../');
4
- const {getConnectedWatchtowers} = require('./../../');
5
- const {getTowerServerInfo} = require('./../../');
6
- const {spawnLnd} = require('./../macros');
7
- const {waitForTermination} = require('./../macros');
8
-
9
- const all = promise => Promise.all(promise);
10
- const nodes = [{watchers: true}, {tower: true}];
11
-
12
- // Connecting to a watchtower should add a watchtower
13
- test(`Connect watchtower`, async ({end, equal, fail, match}) => {
14
- let client;
15
- let tower;
16
-
17
- client = await spawnLnd({watchers: true});
18
- tower = await spawnLnd({tower: true});
19
-
20
- const info = (await getTowerServerInfo({lnd: tower.lnd})).tower;
21
- const {lnd} = client;
22
-
23
- const [socket] = info.sockets;
24
-
25
- try {
26
- await connectWatchtower({lnd, socket, public_key: info.public_key});
27
-
28
- const [watcher] = (await getConnectedWatchtowers({lnd})).towers;
29
-
30
- equal(watcher.is_active, true, 'Tower is active');
31
- equal(watcher.public_key, info.public_key, 'Tower public key added');
32
- equal(watcher.sessions.length, [].length, 'Tower has no sessions');
33
- equal(watcher.sockets.pop(), socket, 'Tower at socket added');
34
- } catch (err) {
35
- equal(err, null, 'Expects no error');
36
- }
37
-
38
- [client, tower].forEach(n => n.kill());
39
-
40
- await all([client, tower].map(({lnd}) => waitForTermination({lnd})));
41
-
42
- return end();
43
- });
@@ -1,55 +0,0 @@
1
- const {test} = require('@alexbosworth/tap');
2
-
3
- const {connectWatchtower} = require('./../../');
4
- const {createCluster} = require('./../macros');
5
- const {delay} = require('./../macros');
6
- const {disconnectWatchtower} = require('./../../');
7
- const {getConnectedWatchtowers} = require('./../../');
8
- const {getTowerServerInfo} = require('./../../');
9
- const {openChannel} = require('./../../');
10
- const {pay} = require('./../../');
11
- const {spawnLnd} = require('./../macros');
12
- const {stopDaemon} = require('./../../');
13
- const {waitForChannel} = require('./../macros');
14
- const {waitForPendingChannel} = require('./../macros');
15
- const {waitForTermination} = require('./../macros');
16
-
17
- // Getting connected watchtowers should return watchtowers
18
- test(`Connect watchtower`, async ({end, equal, match}) => {
19
- let control;
20
- let tower;
21
-
22
- control = await spawnLnd({watchers: true});
23
- tower = await spawnLnd({tower: true});
24
-
25
- const info = (await getTowerServerInfo({lnd: tower.lnd})).tower;
26
- const {lnd} = control;
27
-
28
- const [socket] = info.sockets;
29
-
30
- await connectWatchtower({lnd, socket, public_key: info.public_key});
31
-
32
- const res = (await getConnectedWatchtowers({lnd}));
33
-
34
- equal(res.backups_count, 0, 'Got backups count');
35
- equal(res.failed_backups_count, 0, 'Got failed backups count');
36
- equal(res.finished_sessions_count, 0, 'Got finished sessions count');
37
- equal(res.max_session_update_count, 1024, 'Got max session update count');
38
- equal(res.pending_backups_count, 0, 'Got pending backups count');
39
- equal(res.sessions_count, 0, 'Got sessions count');
40
- equal(res.sweep_tokens_per_vbyte, 10, 'Got sweep tokens per vbyte');
41
-
42
- const [watcher] = res.towers;
43
-
44
- equal(watcher.is_active, true, 'Tower is active');
45
- equal(watcher.public_key, info.public_key, 'Tower is connected');
46
- equal(watcher.sessions.length, [].length, 'No sessions initiated');
47
- equal(watcher.sockets.slice().pop(), socket, 'Tower socket returned');
48
-
49
- [control, tower].forEach(n => n.kill());
50
-
51
- await waitForTermination({lnd});
52
- await waitForTermination({lnd: tower.lnd});
53
-
54
- return end();
55
- });