ln-service 53.7.1 → 53.7.2

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
- ## 53.7.1
3
+ ## 53.7.2
4
4
 
5
5
  - `payViaRoutes`, `subscribeToPayViaRoutes`: Add support for relay messages
6
6
 
package/package.json CHANGED
@@ -26,9 +26,9 @@
26
26
  "bitcoinjs-lib": "6.0.1",
27
27
  "bn.js": "5.2.0",
28
28
  "ecpair": "2.0.1",
29
- "ln-docker-daemons": "2.2.3",
29
+ "ln-docker-daemons": "2.2.4",
30
30
  "portfinder": "1.0.28",
31
- "psbt": "1.1.11",
31
+ "psbt": "2.0.0",
32
32
  "rimraf": "3.0.2",
33
33
  "secp256k1": "4.0.3",
34
34
  "tiny-secp256k1": "2.2.0",
@@ -64,7 +64,7 @@
64
64
  "integration-test-0.13.0": "DOCKER_LND_VERSION=v0.13.0-beta npm run test",
65
65
  "integration-test-0.12.1": "DOCKER_LND_VERSION=v0.12.1-beta npm run test",
66
66
  "integration-test-0.12.0": "DOCKER_LND_VERSION=v0.12.0-beta npm run test",
67
- "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/routerrpc-integration/*.js test/signerrpc-integration/*.js test/tower_clientrpc-integration/*.js test/tower_serverrpc-integration/*.js test/walletrpc-integration/*.js"
67
+ "test": "echo $DOCKER_LND_VERSION && tap -j 3 --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/routerrpc-integration/*.js test/signerrpc-integration/*.js test/tower_clientrpc-integration/*.js test/tower_serverrpc-integration/*.js test/walletrpc-integration/*.js"
68
68
  },
69
- "version": "53.7.1"
69
+ "version": "53.7.2"
70
70
  }
@@ -9,7 +9,7 @@ const {getPeers} = require('./../../');
9
9
  const interval = 100;
10
10
  const size = 2;
11
11
  const times = 100;
12
- const timeout = 1;
12
+ const timeout = 1000;
13
13
 
14
14
  // Adding peers should result in a connected peer
15
15
  test(`Add a peer`, async ({end, equal}) => {
@@ -27,6 +27,8 @@ test(`Add a peer`, async ({end, equal}) => {
27
27
  lnd,
28
28
  timeout,
29
29
  public_key: target.id,
30
+ retry_count: 1,
31
+ retry_delay: 1,
30
32
  socket: target.socket,
31
33
  });
32
34
 
@@ -5,6 +5,7 @@ const asyncRetry = require('async/retry');
5
5
  const {extractTransaction} = require('psbt');
6
6
  const {spawnLightningCluster} = require('ln-docker-daemons');
7
7
  const {test} = require('@alexbosworth/tap');
8
+ const tinysecp = require('tiny-secp256k1');
8
9
 
9
10
  const {addPeer} = require('./../../');
10
11
  const {broadcastChainTransaction} = require('./../../');
@@ -27,11 +28,13 @@ const count = 100;
27
28
  const interval = 100;
28
29
  const race = promises => Promise.race(promises);
29
30
  const size = 3;
30
- const timeout = 1000 * 5;
31
+ const timeout = 1000 * 20;
31
32
  const times = 200;
32
33
 
33
34
  // Forfeiting a pending channel should remove the pending channel
34
35
  test(`Forfeit pending channel`, async ({end, equal, strictSame}) => {
36
+ const ecp = (await import('ecpair')).ECPairFactory(tinysecp);
37
+
35
38
  const {kill, nodes} = await spawnLightningCluster({size});
36
39
 
37
40
  const [control, target, remote] = nodes;
@@ -105,7 +108,7 @@ test(`Forfeit pending channel`, async ({end, equal, strictSame}) => {
105
108
  funding: signRemote.psbt,
106
109
  });
107
110
 
108
- const {transaction} = extractTransaction({psbt: signRemote.psbt});
111
+ const {transaction} = extractTransaction({ecp, psbt: signRemote.psbt});
109
112
 
110
113
  await broadcastChainTransaction({lnd, transaction});
111
114
 
@@ -17,29 +17,33 @@ test(`Get wallet info`, async ({end, equal, strictSame}) => {
17
17
 
18
18
  const [{lnd}] = nodes;
19
19
 
20
- const result = await getWalletInfo({lnd});
21
-
22
- await asyncRetry({interval, times}, async () => {
23
- if (result.current_block_height === initHeight) {
24
- return;
25
- }
26
-
27
- throw new Error('ExpectedBlockHeightAtInitHeight');
28
- });
29
-
30
- equal(result.active_channels_count, 0, 'Expected channels count');
31
- equal(!!result.alias, true, 'Expected alias');
32
- strictSame(result.chains, [regtestChainId], 'Got chains');
33
- equal(!!result.current_block_hash, true, 'Expected best block hash');
34
- equal(result.current_block_height, initHeight, 'Expected best block height');
35
- equal(!!result.latest_block_at, true, 'Last block time');
36
- equal(result.peers_count, 0, 'Expected wallet peers count');
37
- equal(result.pending_channels_count, 0, 'Expected pending channels count');
38
- equal(result.public_key.length, pubKeyHexLength, 'Expected public key');
39
- strictSame(result.uris.length, 1, 'Expected node URI');
40
- equal(!!result.version, true, 'Expected version');
41
-
42
- await kill({});
20
+ try {
21
+ const result = await asyncRetry({interval, times}, async () => {
22
+ const result = await getWalletInfo({lnd});
23
+
24
+ if (result.current_block_height === initHeight) {
25
+ return result;
26
+ }
27
+
28
+ throw new Error('ExpectedBlockHeightAtInitHeight');
29
+ });
30
+
31
+ equal(result.active_channels_count, 0, 'Expected channels count');
32
+ equal(!!result.alias, true, 'Expected alias');
33
+ strictSame(result.chains, [regtestChainId], 'Got chains');
34
+ equal(!!result.current_block_hash, true, 'Expected best block hash');
35
+ equal(result.current_block_height, initHeight, 'Expected best block height');
36
+ equal(!!result.latest_block_at, true, 'Last block time');
37
+ equal(result.peers_count, 0, 'Expected wallet peers count');
38
+ equal(result.pending_channels_count, 0, 'Expected pending channels count');
39
+ equal(result.public_key.length, pubKeyHexLength, 'Expected public key');
40
+ strictSame(result.uris.length, 1, 'Expected node URI');
41
+ equal(!!result.version, true, 'Expected version');
42
+ } catch (err) {
43
+ equal(err, null, 'Expected no error');
44
+ } finally {
45
+ await kill({});
46
+ }
43
47
 
44
48
  return end();
45
49
  });
@@ -4,6 +4,7 @@ const {extractTransaction} = require('psbt');
4
4
  const {finalizePsbt} = require('psbt');
5
5
  const {spawnLightningCluster} = require('ln-docker-daemons');
6
6
  const {test} = require('@alexbosworth/tap');
7
+ const tinysecp = require('tiny-secp256k1');
7
8
  const {transactionAsPsbt} = require('psbt');
8
9
 
9
10
  const {addPeer} = require('./../../');
@@ -29,27 +30,29 @@ const times = 2000;
29
30
 
30
31
  // Opening channels should open up channels
31
32
  test(`Open channels`, async ({end, equal}) => {
33
+ const ecp = (await import('ecpair')).ECPairFactory(tinysecp);
34
+
32
35
  const {kill, nodes} = await spawnLightningCluster({size});
33
36
 
34
37
  const [{generate, lnd}, target, remote] = nodes;
35
38
 
36
39
  await generate({count: maturity});
37
40
 
38
- await asyncRetry({interval, times}, async () => {
39
- const lnds = [lnd, target.lnd, remote.lnd];
41
+ try {
42
+ await asyncRetry({interval, times}, async () => {
43
+ const lnds = [lnd, target.lnd, remote.lnd];
40
44
 
41
- const heights = await asyncMap(lnds, async lnd => {
42
- return (await getHeight({lnd})).current_block_height;
43
- });
45
+ const heights = await asyncMap(lnds, async lnd => {
46
+ return (await getHeight({lnd})).current_block_height;
47
+ });
44
48
 
45
- const [controlHeight, targetHeight, remoteHeight] = heights;
49
+ const [controlHeight, targetHeight, remoteHeight] = heights;
46
50
 
47
- if (controlHeight !== targetHeight || controlHeight !== remoteHeight) {
48
- throw new Error('ExpectedSyncHeights');
49
- }
50
- });
51
+ if (controlHeight !== targetHeight || controlHeight !== remoteHeight) {
52
+ throw new Error('ExpectedSyncHeights');
53
+ }
54
+ });
51
55
 
52
- try {
53
56
  const chainTx = (await getChainTransactions({lnd})).transactions;
54
57
 
55
58
  const spending = chainTx.map(({transaction}) => transaction);
@@ -97,11 +100,15 @@ test(`Open channels`, async ({end, equal}) => {
97
100
  .map(({transaction}) => transaction)
98
101
  .find(transaction => spending.find(spend => transaction !== spend));
99
102
 
100
- const fundingPsbt = transactionAsPsbt({spending, transaction: fundTx});
103
+ const fundingPsbt = transactionAsPsbt({
104
+ ecp,
105
+ spending,
106
+ transaction: fundTx,
107
+ });
101
108
 
102
- const {psbt} = finalizePsbt({psbt: fundingPsbt.psbt});
109
+ const {psbt} = finalizePsbt({ecp, psbt: fundingPsbt.psbt});
103
110
 
104
- const reconstitutedTransaction = extractTransaction({psbt});
111
+ const reconstitutedTransaction = extractTransaction({ecp, psbt});
105
112
 
106
113
  await fundPendingChannels({
107
114
  lnd,