ln-service 56.7.1 → 56.8.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.
Files changed (144) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +4 -1
  3. package/package.json +12 -12
  4. package/test/autopilotrpc-integration/test_autopilot.js +30 -16
  5. package/test/chainrpc-integration/test_get_block.js +14 -11
  6. package/test/chainrpc-integration/test_get_height.js +10 -4
  7. package/test/chainrpc-integration/test_subscribe_to_blocks.js +10 -9
  8. package/test/chainrpc-integration/test_subscribe_to_chain_address.js +11 -9
  9. package/test/chainrpc-integration/test_subscribe_to_chain_spend.js +9 -8
  10. package/test/integration/test_add_peer.js +12 -6
  11. package/test/integration/test_cancel_pending_channel.js +9 -12
  12. package/test/integration/test_close_channel.js +12 -11
  13. package/test/integration/test_create_chain_address.js +5 -3
  14. package/test/integration/test_create_invoice.js +19 -15
  15. package/test/integration/test_decode_payment_request.js +19 -16
  16. package/test/integration/test_delete_payment.js +11 -30
  17. package/test/integration/test_delete_payments.js +8 -8
  18. package/test/integration/test_delete_pending_channel.js +13 -27
  19. package/test/integration/test_get_access_ids.js +7 -15
  20. package/test/integration/test_get_backup.js +12 -14
  21. package/test/integration/test_get_backups.js +11 -9
  22. package/test/integration/test_get_chain_balance.js +8 -8
  23. package/test/integration/test_get_chain_fee_estimate.js +8 -6
  24. package/test/integration/test_get_chain_transactions.js +22 -21
  25. package/test/integration/test_get_channel.js +19 -17
  26. package/test/integration/test_get_channel_balance.js +6 -4
  27. package/test/integration/test_get_channels.js +42 -39
  28. package/test/integration/test_get_closed_channels.js +95 -114
  29. package/test/integration/test_get_failed_payments.js +43 -42
  30. package/test/integration/test_get_fee_rates.js +13 -11
  31. package/test/integration/test_get_forwards.js +27 -24
  32. package/test/integration/test_get_invoice.js +31 -24
  33. package/test/integration/test_get_invoices.js +18 -15
  34. package/test/integration/test_get_methods.js +13 -16
  35. package/test/integration/test_get_network_centrality.js +15 -13
  36. package/test/integration/test_get_network_graph.js +36 -23
  37. package/test/integration/test_get_network_info.js +13 -11
  38. package/test/integration/test_get_node.js +27 -21
  39. package/test/integration/test_get_payments.js +20 -18
  40. package/test/integration/test_get_peers.js +16 -14
  41. package/test/integration/test_get_pending_coop.js +49 -39
  42. package/test/integration/test_get_pending_force.js +67 -90
  43. package/test/integration/test_get_pending_payments.js +23 -24
  44. package/test/integration/test_get_route_to_destination.js +15 -15
  45. package/test/integration/test_get_settlement_status.js +13 -9
  46. package/test/integration/test_get_utxos.js +13 -11
  47. package/test/integration/test_get_wallet_info.js +20 -16
  48. package/test/integration/test_grant_access.js +20 -23
  49. package/test/integration/test_open_channel.js +10 -8
  50. package/test/integration/test_open_channels.js +11 -10
  51. package/test/integration/test_pay.js +18 -27
  52. package/test/integration/test_pay_private_invoice.js +11 -24
  53. package/test/integration/test_payment_errors.js +10 -11
  54. package/test/integration/test_propose_channel.js +70 -105
  55. package/test/integration/test_push_funds.js +8 -10
  56. package/test/integration/test_rebalance.js +44 -32
  57. package/test/integration/test_recover_funds_from_channel.js +13 -11
  58. package/test/integration/test_recover_funds_from_channels.js +13 -11
  59. package/test/integration/test_remove_peer.js +8 -6
  60. package/test/integration/test_restrict_macaroon.js +8 -5
  61. package/test/integration/test_revoke_access.js +19 -24
  62. package/test/integration/test_send_message_to_peer.js +11 -6
  63. package/test/integration/test_send_to_chain_address.js +13 -12
  64. package/test/integration/test_send_to_chain_addresses.js +10 -8
  65. package/test/integration/test_sign_message.js +6 -4
  66. package/test/integration/test_stop_daemon.js +7 -4
  67. package/test/integration/test_subscribe_to_backups.js +7 -5
  68. package/test/integration/test_subscribe_to_channels.js +10 -21
  69. package/test/integration/test_subscribe_to_graph.js +17 -9
  70. package/test/integration/test_subscribe_to_invoices.js +10 -8
  71. package/test/integration/test_subscribe_to_open_requests.js +13 -12
  72. package/test/integration/test_subscribe_to_peer_messages.js +8 -5
  73. package/test/integration/test_subscribe_to_peers.js +7 -6
  74. package/test/integration/test_subscribe_to_rpc_requests.js +202 -191
  75. package/test/integration/test_subscribe_to_transactions.js +6 -4
  76. package/test/integration/test_trusted_funding.js +17 -11
  77. package/test/integration/test_update_routing_fees.js +8 -5
  78. package/test/integration/test_verify_access.js +8 -6
  79. package/test/integration/test_verify_backup.js +6 -6
  80. package/test/integration/test_verify_backups.js +6 -6
  81. package/test/integration/test_verify_message.js +5 -3
  82. package/test/invoicesrpc-integration/test_cancel_invoice.js +6 -5
  83. package/test/invoicesrpc-integration/test_get_sweep_transactions.js +6 -7
  84. package/test/invoicesrpc-integration/test_push_payment.js +7 -6
  85. package/test/invoicesrpc-integration/test_settle_invoice.js +10 -6
  86. package/test/invoicesrpc-integration/test_subscribe_cancel_invoice.js +8 -7
  87. package/test/invoicesrpc-integration/test_subscribe_settle_invoice.js +8 -7
  88. package/test/peersrpc-integration/test_add_external_socket.js +7 -5
  89. package/test/peersrpc-integration/test_remove_external_socket.js +7 -5
  90. package/test/peersrpc-integration/test_update_alias.js +8 -6
  91. package/test/peersrpc-integration/test_update_color.js +8 -6
  92. package/test/routerrpc-integration/test_delete_forwarding_reputations.js +8 -6
  93. package/test/routerrpc-integration/test_disable_channel.js +6 -4
  94. package/test/routerrpc-integration/test_get_forwarding_confidence.js +7 -5
  95. package/test/routerrpc-integration/test_get_forwarding_reputations.js +12 -7
  96. package/test/routerrpc-integration/test_get_pathfinding_settings.js +7 -5
  97. package/test/routerrpc-integration/test_get_payment.js +10 -6
  98. package/test/routerrpc-integration/test_get_route_confidence.js +6 -4
  99. package/test/routerrpc-integration/test_get_route_through_hops.js +8 -7
  100. package/test/routerrpc-integration/test_is_destination_payable.js +11 -8
  101. package/test/routerrpc-integration/test_multipath_payment.js +8 -5
  102. package/test/routerrpc-integration/test_pay_via_payment_details.js +11 -9
  103. package/test/routerrpc-integration/test_pay_via_payment_request.js +11 -7
  104. package/test/routerrpc-integration/test_pay_via_routes.js +8 -11
  105. package/test/routerrpc-integration/test_probe_for_route.js +10 -7
  106. package/test/routerrpc-integration/test_subscribe_to_forward_requests.js +10 -7
  107. package/test/routerrpc-integration/test_subscribe_to_forwards.js +23 -19
  108. package/test/routerrpc-integration/test_subscribe_to_past_payments.js +8 -6
  109. package/test/routerrpc-integration/test_subscribe_to_payments.js +18 -17
  110. package/test/routerrpc-integration/test_update_pathfinding_settings.js +8 -6
  111. package/test/runner.js +30 -0
  112. package/test/signerrpc-integration/test_begin_group_signing_session.js +8 -5
  113. package/test/signerrpc-integration/test_diffie_hellman_compute_secret.js +7 -4
  114. package/test/signerrpc-integration/test_sign_bytes.js +5 -3
  115. package/test/signerrpc-integration/test_sign_taproot.js +6 -4
  116. package/test/signerrpc-integration/test_sign_transaction.js +5 -3
  117. package/test/signerrpc-integration/test_verify_bytes_signature.js +5 -4
  118. package/test/tower_clientrpc-integration/test_connect_watchtower.js +7 -4
  119. package/test/tower_clientrpc-integration/test_get_connected_watchtowers.js +7 -4
  120. package/test/tower_serverrpc-integration/test_get_tower_server_info.js +6 -3
  121. package/test/versionrpc-integration/test_get_wallet_version.js +16 -12
  122. package/test/walletrpc-integration/test_broadcast_chain_transaction.js +5 -3
  123. package/test/walletrpc-integration/test_fund_psbt.js +5 -10
  124. package/test/walletrpc-integration/test_get_chain_addresses.js +9 -7
  125. package/test/walletrpc-integration/test_get_chain_fee_rate.js +5 -3
  126. package/test/walletrpc-integration/test_get_locked_utxos.js +8 -20
  127. package/test/walletrpc-integration/test_get_master_public_keys.js +9 -6
  128. package/test/walletrpc-integration/test_get_public_key.js +5 -3
  129. package/test/walletrpc-integration/test_lock_utxo.js +9 -5
  130. package/test/walletrpc-integration/test_partially_sign_psbt.js +7 -4
  131. package/test/walletrpc-integration/test_request_chain_fee_increase.js +8 -4
  132. package/test/walletrpc-integration/test_send_to_chain_output_scripts.js +7 -4
  133. package/test/walletrpc-integration/test_sign_chain_address_message.js +6 -6
  134. package/test/walletrpc-integration/test_sign_psbt.js +6 -4
  135. package/test/walletrpc-integration/test_unlock_utxo.js +8 -4
  136. package/test/walletrpc-integration/test_update_chain_transaction.js +5 -3
  137. package/test/walletrpc-integration/test_verify_chain_address_message.js +6 -4
  138. package/test/extra-integration/test_change_password.js +0 -15
  139. package/test/extra-integration/test_get_wallet_status.js +0 -45
  140. package/test/extra-integration/test_no_macaroon.js +0 -20
  141. package/test/extra-integration/tower_clientrpc-integration/test_disconnect_watchtower.js +0 -51
  142. package/test/extra-integration/tower_clientrpc-integration/test_update_connected_watchtower.js +0 -76
  143. package/test/grpc-integration/test_authenticated_lnd_grpc.js +0 -40
  144. package/test/routers-integration/test_gateway_router.js +0 -87
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Versions
2
2
 
3
+ ## 56.8.1
4
+
5
+ - `getPendingChannels`: Add `blocks_until_expiry` for opening funding expiry
6
+
3
7
  ## 56.7.1
4
8
 
5
9
  - `isDestinationPayable`: Correct behavior for passing variations of amounts
package/README.md CHANGED
@@ -9,7 +9,7 @@ through npm.
9
9
 
10
10
  Supported LND versions:
11
11
 
12
- - v0.16.0-beta to v0.16.3-beta
12
+ - v0.16.0-beta to v0.16.4-beta
13
13
  - v0.15.2-beta to v0.15.5-beta
14
14
  - v0.14.4-beta to v0.14.5-beta
15
15
 
@@ -2885,6 +2885,8 @@ Requires `offchain:read` permission
2885
2885
 
2886
2886
  `description` is not supported in LND 0.16.4 or before
2887
2887
 
2888
+ `blocks_until_expiry` is not supported in LND 0.16.4 or before
2889
+
2888
2890
  {
2889
2891
  lnd: <Authenticated LND API Object>
2890
2892
  }
@@ -2892,6 +2894,7 @@ Requires `offchain:read` permission
2892
2894
  @returns via cbk or Promise
2893
2895
  {
2894
2896
  pending_channels: [{
2897
+ [blocks_until_expiry]: <Blocks Until Open Channel Expires Number>
2895
2898
  capacity: <Channel Capacity Tokens Number>
2896
2899
  [close_transaction_id]: <Channel Closing Transaction Id String>
2897
2900
  [description]: <Channel Description String>
package/package.json CHANGED
@@ -7,35 +7,34 @@
7
7
  "url": "https://github.com/alexbosworth/ln-service/issues"
8
8
  },
9
9
  "dependencies": {
10
- "bolt07": "1.8.3",
10
+ "bolt07": "1.8.4",
11
11
  "cors": "2.8.5",
12
12
  "express": "4.18.2",
13
- "invoices": "2.2.3",
14
- "lightning": "9.7.1",
13
+ "invoices": "3.0.0",
14
+ "lightning": "9.8.1",
15
15
  "macaroon": "3.0.4",
16
16
  "morgan": "1.10.0",
17
17
  "ws": "8.13.0"
18
18
  },
19
19
  "description": "Interaction helper for your Lightning Network daemon",
20
20
  "devDependencies": {
21
- "@alexbosworth/blockchain": "1.4.0",
22
- "@alexbosworth/tap": "15.0.12",
21
+ "@alexbosworth/blockchain": "1.5.0",
23
22
  "@alexbosworth/node-fetch": "2.6.2",
24
23
  "async": "3.2.4",
25
- "asyncjs-util": "1.2.11",
24
+ "asyncjs-util": "1.2.12",
26
25
  "bip32": "4.0.0",
27
26
  "bip66": "1.1.5",
28
27
  "bitcoinjs-lib": "6.1.3",
29
28
  "bn.js": "5.2.1",
30
29
  "bs58check": "3.0.1",
31
30
  "ecpair": "2.1.0",
32
- "ln-docker-daemons": "5.0.6",
33
- "p2tr": "1.3.3",
31
+ "ln-docker-daemons": "5.1.1",
32
+ "p2tr": "2.0.0",
34
33
  "portfinder": "1.0.32",
35
- "psbt": "2.7.2",
34
+ "psbt": "3.0.0",
36
35
  "rimraf": "5.0.1",
37
36
  "secp256k1": "5.0.0",
38
- "tiny-secp256k1": "2.2.2",
37
+ "tiny-secp256k1": "2.2.3",
39
38
  "uuid": "9.0.0",
40
39
  "varuint-bitcoin": "1.1.2"
41
40
  },
@@ -57,6 +56,7 @@
57
56
  "url": "https://github.com/alexbosworth/ln-service.git"
58
57
  },
59
58
  "scripts": {
59
+ "integration-test-0.16.4": "DOCKER_LND_VERSION=v0.16.4-beta npm run test",
60
60
  "integration-test-0.16.3": "DOCKER_LND_VERSION=v0.16.3-beta npm run test",
61
61
  "integration-test-0.16.2": "DOCKER_LND_VERSION=v0.16.2-beta npm run test",
62
62
  "integration-test-0.16.1": "DOCKER_LND_VERSION=v0.16.1-beta npm run test",
@@ -67,7 +67,7 @@
67
67
  "integration-test-0.15.2": "DOCKER_LND_VERSION=v0.15.2-beta npm run test",
68
68
  "integration-test-0.14.5": "DOCKER_LND_VERSION=v0.14.5-beta npm run test",
69
69
  "integration-test-0.14.4": "DOCKER_LND_VERSION=v0.14.4-beta npm run test",
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"
70
+ "test": "echo $DOCKER_LND_VERSION && node test/runner"
71
71
  },
72
- "version": "56.7.1"
72
+ "version": "56.8.1"
73
73
  }
@@ -1,20 +1,22 @@
1
+ const {strictEqual} = require('node:assert').strict;
2
+ const test = require('node:test');
3
+
4
+ const {setupChannel} = require('ln-docker-daemons');
1
5
  const {spawnLightningCluster} = require('ln-docker-daemons');
2
- const {test} = require('@alexbosworth/tap');
3
6
 
4
7
  const {addPeer} = require('./../../');
5
- const {delay} = require('./../macros');
6
8
  const {getAutopilot} = require('./../../');
7
9
  const {setAutopilot} = require('./../../');
8
- const {setupChannel} = require('./../macros');
9
10
 
10
11
  const avg = array => array.reduce((a, b) => a + b) / array.length;
11
12
  const confirmationCount = 6;
13
+ const delay = ms => new Promise(resolve => setTimeout(resolve, ms));
12
14
  const maxScore = 1e8;
13
15
  const score = 50000000;
14
16
  const size = 2;
15
17
 
16
18
  // Adjusting autopilot should result in changed autopilot status
17
- test(`Autopilot`, async ({end, equal}) => {
19
+ test(`Autopilot`, async () => {
18
20
  const {kill, nodes} = await spawnLightningCluster({size});
19
21
 
20
22
  const [control, target] = nodes;
@@ -25,7 +27,11 @@ test(`Autopilot`, async ({end, equal}) => {
25
27
 
26
28
  await setupChannel({lnd, generate: control.generate, to: cluster.target});
27
29
 
28
- equal((await getAutopilot({lnd})).is_enabled, false, 'Autopilot starts off');
30
+ strictEqual(
31
+ (await getAutopilot({lnd})).is_enabled,
32
+ false,
33
+ 'Autopilot starts off'
34
+ );
29
35
 
30
36
  await Promise.all([
31
37
  cluster.control.generate({count: confirmationCount}),
@@ -39,11 +45,19 @@ test(`Autopilot`, async ({end, equal}) => {
39
45
  socket: cluster.target.socket,
40
46
  });
41
47
 
42
- equal((await getAutopilot({lnd})).is_enabled, true, 'Autopilot turned on');
48
+ strictEqual(
49
+ (await getAutopilot({lnd})).is_enabled,
50
+ true,
51
+ 'Autopilot turned on'
52
+ );
43
53
 
44
54
  await setAutopilot({lnd, is_enabled: false});
45
55
 
46
- equal((await getAutopilot({lnd})).is_enabled, false, 'Autopilot turned off');
56
+ strictEqual(
57
+ (await getAutopilot({lnd})).is_enabled,
58
+ false,
59
+ 'Autopilot turned off'
60
+ );
47
61
 
48
62
  const pubKey = cluster.control.id;
49
63
 
@@ -55,19 +69,19 @@ test(`Autopilot`, async ({end, equal}) => {
55
69
 
56
70
  const autopilot = await getAutopilot({lnd, node_scores: [pubKey]});
57
71
 
58
- equal(autopilot.is_enabled, true, 'Autopilot was enable');
72
+ strictEqual(autopilot.is_enabled, true, 'Autopilot was enable');
59
73
 
60
74
  const [node] = autopilot.nodes;
61
75
 
62
- equal(node.local_preferential_score, maxScore, 'Local preferential score');
63
- equal(node.local_score, score, 'Local score is represented');
64
- equal(node.preferential_score, maxScore, 'Global preferential score');
65
- equal(node.public_key, pubKey, 'Candidate node public key');
66
- equal(node.score, score, 'External score is represented');
67
- equal(node.weighted_local_score, avg([maxScore, score]), 'Weight averaged');
68
- equal(node.weighted_score, avg([maxScore, score]), 'Normal Weight average');
76
+ strictEqual(node.local_preferential_score, maxScore, 'Local score');
77
+ strictEqual(node.local_score, score, 'Local score is represented');
78
+ strictEqual(node.preferential_score, maxScore, 'Global preferential score');
79
+ strictEqual(node.public_key, pubKey, 'Candidate node public key');
80
+ strictEqual(node.score, score, 'External score is represented');
81
+ strictEqual(node.weighted_local_score, avg([maxScore, score]), 'Weight avg');
82
+ strictEqual(node.weighted_score, avg([maxScore, score]), 'Norm Weight avg');
69
83
 
70
84
  await kill({});
71
85
 
72
- return end();
86
+ return;
73
87
  });
@@ -1,12 +1,14 @@
1
+ const {strictEqual} = require('node:assert').strict;
2
+ const test = require('node:test');
3
+
1
4
  const {idForBlock} = require('@alexbosworth/blockchain');
2
5
  const {spawnLightningCluster} = require('ln-docker-daemons');
3
- const {test} = require('@alexbosworth/tap');
4
6
 
5
7
  const {getBlock} = require('./../../');
6
8
  const {getHeight} = require('./../../');
7
9
 
8
10
  // Get height should return height
9
- test(`Get height`, async ({end, equal, fail}) => {
11
+ test(`Get height`, async () => {
10
12
  const {nodes} = await spawnLightningCluster({});
11
13
 
12
14
  const [{chain, generate, kill, lnd}] = nodes;
@@ -20,36 +22,37 @@ test(`Get height`, async ({end, equal, fail}) => {
20
22
  try {
21
23
  const {block} = await getBlock({lnd, id: blockchain.current_block_hash});
22
24
 
23
- equal(idForBlock({block}).id, hash, 'Got block');
25
+ strictEqual(idForBlock({block}).id, hash, 'Got block');
24
26
  } catch (err) {
25
27
  const [code, message] = err;
26
28
 
27
- equal(code, 501, 'Got expected code');
28
- equal(message, 'GetBlockMethodNotSupported', 'Got expected message');
29
+ strictEqual(code, 501, 'Got expected code');
30
+ strictEqual(message, 'GetBlockMethodNotSupported', 'Got expected message');
29
31
 
30
32
  await kill({});
31
33
 
32
- return end();
34
+ return;
33
35
  }
34
36
 
35
37
  // Try getting a block by the height
36
38
  try {
37
39
  const {block} = await getBlock({height, lnd});
38
- equal(idForBlock({block}).id, hash, 'Got block for height');
40
+
41
+ strictEqual(idForBlock({block}).id, hash, 'Got block for height');
39
42
  } catch (err) {
40
- equal(err, null, 'Expected no error');
43
+ strictEqual(err, null, 'Expected no error');
41
44
  }
42
45
 
43
46
  // Try getting the chain tip block
44
47
  try {
45
48
  const {block} = await getBlock({lnd});
46
49
 
47
- equal(idForBlock({block}).id, hash, 'Got chain tip block');
50
+ strictEqual(idForBlock({block}).id, hash, 'Got chain tip block');
48
51
  } catch (err) {
49
- equal(err, null, 'Expected no error');
52
+ strictEqual(err, null, 'Expected no error');
50
53
  }
51
54
 
52
55
  await kill({});
53
56
 
54
- return end();
57
+ return;
55
58
  });
@@ -1,6 +1,8 @@
1
+ const {strictEqual} = require('node:assert').strict;
2
+ const test = require('node:test');
3
+
1
4
  const asyncRetry = require('async/retry');
2
5
  const {spawnLightningCluster} = require('ln-docker-daemons');
3
- const {test} = require('@alexbosworth/tap');
4
6
 
5
7
  const {getHeight} = require('./../../');
6
8
 
@@ -8,7 +10,7 @@ const confirmationCount = 6;
8
10
  const times = 100;
9
11
 
10
12
  // Get height should return height
11
- test(`Get height`, async ({end, equal, fail}) => {
13
+ test(`Get height`, async () => {
12
14
  const {nodes} = await spawnLightningCluster({});
13
15
 
14
16
  const [{chain, generate, kill, lnd}] = nodes;
@@ -24,12 +26,16 @@ test(`Get height`, async ({end, equal, fail}) => {
24
26
  throw new Error('ExpectedHeightIncreaseReflected');
25
27
  }
26
28
 
27
- equal(endHeight - startHeight >= confirmationCount, true, 'Got height');
29
+ strictEqual(
30
+ endHeight - startHeight >= confirmationCount,
31
+ true,
32
+ 'Got height'
33
+ );
28
34
 
29
35
  return;
30
36
  });
31
37
 
32
38
  await kill({});
33
39
 
34
- return end();
40
+ return;
35
41
  });
@@ -1,9 +1,10 @@
1
- const EventEmitter = require('events');
2
- const {once} = require('events');
1
+ const EventEmitter = require('node:events');
2
+ const {once} = require('node:events');
3
+ const {strictEqual} = require('node:assert').strict;
4
+ const test = require('node:test');
3
5
 
4
6
  const asyncRetry = require('async/retry');
5
7
  const {spawnLightningCluster} = require('ln-docker-daemons');
6
- const {test} = require('@alexbosworth/tap');
7
8
 
8
9
  const {createChainAddress} = require('./../../');
9
10
  const {delay} = require('./../macros');
@@ -19,7 +20,7 @@ const race = promises => Promise.race(promises);
19
20
  const times = 4000;
20
21
 
21
22
  // Subscribers to blocks should receive block notifications
22
- test(`Subscribe to blocks`, async ({end, equal, fail}) => {
23
+ test(`Subscribe to blocks`, async () => {
23
24
  const blocks = [];
24
25
  const {kill, nodes} = await spawnLightningCluster({});
25
26
 
@@ -40,7 +41,7 @@ test(`Subscribe to blocks`, async ({end, equal, fail}) => {
40
41
  return !!event.height;
41
42
  });
42
43
 
43
- equal(gotHeight, true, 'Got the block height');
44
+ strictEqual(gotHeight, true, 'Got the block height');
44
45
 
45
46
  try {
46
47
  // Wait for chainrpc to be active
@@ -73,15 +74,15 @@ test(`Subscribe to blocks`, async ({end, equal, fail}) => {
73
74
  });
74
75
 
75
76
  blocks.forEach(({height, id}) => {
76
- equal(!!height, true, 'Got expected block height');
77
- equal(id.length, 64, 'Got expected block hash length');
77
+ strictEqual(!!height, true, 'Got expected block height');
78
+ strictEqual(id.length, 64, 'Got expected block hash length');
78
79
  return;
79
80
  });
80
81
  } catch (err) {
81
- equal(err, null, 'Expected no error');
82
+ strictEqual(err, null, 'Expected no error');
82
83
  } finally {
83
84
  await kill({});
84
85
 
85
- return end();
86
+ return;
86
87
  }
87
88
  });
@@ -1,6 +1,8 @@
1
+ const {strictEqual} = require('node:assert').strict;
2
+ const test = require('node:test');
3
+
1
4
  const asyncRetry = require('async/retry');
2
5
  const {spawnLightningCluster} = require('ln-docker-daemons');
3
- const {test} = require('@alexbosworth/tap');
4
6
 
5
7
  const {chainSendTransaction} = require('./../macros');
6
8
  const {createChainAddress} = require('./../../');
@@ -23,7 +25,7 @@ const times = 1500;
23
25
  const tokens = 1e8;
24
26
 
25
27
  // Subscribing to chain transaction confirmations should trigger events
26
- test(`Subscribe to chain transactions`, async ({end, equal, fail}) => {
28
+ test(`Subscribe to chain transactions`, async () => {
27
29
  const {kill, nodes} = await spawnLightningCluster({});
28
30
 
29
31
  const [{chain, generate, lnd}] = nodes;
@@ -77,9 +79,9 @@ test(`Subscribe to chain transactions`, async ({end, equal, fail}) => {
77
79
  throw new Error('ExpectedSubscribeToChainAddressSeesConf');
78
80
  }
79
81
 
80
- equal(firstConf.block.length, 64, 'Confirmation block hash returned');
81
- equal(firstConf.height >= 102, true, 'Got confirmation block height');
82
- equal(firstConf.transaction, transaction, 'Confirmation raw tx');
82
+ strictEqual(firstConf.block.length, 64, 'Confirmation hash returned');
83
+ strictEqual(firstConf.height >= 102, true, 'Got confirmation height');
84
+ strictEqual(firstConf.transaction, transaction, 'Confirmation raw tx');
83
85
 
84
86
  return;
85
87
  });
@@ -105,9 +107,9 @@ test(`Subscribe to chain transactions`, async ({end, equal, fail}) => {
105
107
  throw new Error('ExpectedSubscribeToChainAddressSeesConfirmation');
106
108
  }
107
109
 
108
- equal(secondConf.block.length, 64, 'Confirmation block hash returned');
109
- equal(secondConf.height >= 102, true, 'Confirmation block height');
110
- equal(secondConf.transaction, transaction, '2nd conf raw tx returned');
110
+ strictEqual(secondConf.block.length, 64, 'Confirmation hash returned');
111
+ strictEqual(secondConf.height >= 102, true, 'Confirmation block height');
112
+ strictEqual(secondConf.transaction, transaction, '2nd conf tx returned');
111
113
 
112
114
  return;
113
115
  });
@@ -117,5 +119,5 @@ test(`Subscribe to chain transactions`, async ({end, equal, fail}) => {
117
119
 
118
120
  await kill({});
119
121
 
120
- return end();
122
+ return;
121
123
  });
@@ -1,8 +1,9 @@
1
- const {once} = require('events');
1
+ const {once} = require('node:events');
2
+ const {strictEqual} = require('node:assert').strict;
3
+ const test = require('node:test');
2
4
 
3
5
  const asyncRetry = require('async/retry');
4
6
  const {spawnLightningCluster} = require('ln-docker-daemons');
5
- const {test} = require('@alexbosworth/tap');
6
7
 
7
8
  const {createChainAddress} = require('./../../');
8
9
  const {getChainBalance} = require('./../../');
@@ -22,7 +23,7 @@ const times = 1000;
22
23
  const tokens = 1e6;
23
24
 
24
25
  // Subscribing to chain spend should push events on spend confirmations
25
- test(`Subscribe to chain spend`, async ({end, equal}) => {
26
+ test(`Subscribe to chain spend`, async () => {
26
27
  let gotAddressConf = false;
27
28
 
28
29
  const {kill, nodes} = await spawnLightningCluster({size});
@@ -77,9 +78,9 @@ test(`Subscribe to chain spend`, async ({end, equal}) => {
77
78
  sub.on('error', err => {});
78
79
 
79
80
  sub.once('confirmation', ({height, transaction, vin}) => {
80
- equal(!!height, true, 'Height of the confirmation is returned');
81
- equal(!!transaction, true, 'Raw transaction is returned');
82
- equal(vin !== undefined, true, 'Transaction input index is returned');
81
+ strictEqual(!!height, true, 'Height of the confirmation is returned');
82
+ strictEqual(!!transaction, true, 'Raw transaction is returned');
83
+ strictEqual(vin !== undefined, true, 'Transaction input index returned');
83
84
 
84
85
  return gotAddressConf = true;
85
86
  });
@@ -109,7 +110,7 @@ test(`Subscribe to chain spend`, async ({end, equal}) => {
109
110
 
110
111
  await kill({});
111
112
 
112
- equal(gotAddressConf, true, 'Subscribe to address sees confirmation');
113
+ strictEqual(gotAddressConf, true, 'Subscribe to address sees confirmation');
113
114
 
114
- return end();
115
+ return;
115
116
  });
@@ -1,6 +1,8 @@
1
+ const {strictEqual} = require('node:assert').strict;
2
+ const test = require('node:test');
3
+
1
4
  const asyncRetry = require('async/retry');
2
5
  const {spawnLightningCluster} = require('ln-docker-daemons');
3
- const {test} = require('@alexbosworth/tap');
4
6
 
5
7
  const {addPeer} = require('./../../');
6
8
  const {createCluster} = require('./../macros');
@@ -12,7 +14,7 @@ const times = 4000;
12
14
  const timeout = 100;
13
15
 
14
16
  // Adding peers should result in a connected peer
15
- test(`Add a peer`, async ({end, equal}) => {
17
+ test(`Add a peer`, async () => {
16
18
  const {kill, nodes} = await spawnLightningCluster({size});
17
19
 
18
20
  const [{lnd}, target] = nodes;
@@ -20,7 +22,11 @@ test(`Add a peer`, async ({end, equal}) => {
20
22
  try {
21
23
  const connectedKeys = (await getPeers({lnd})).peers.map(n => n.public_key);
22
24
 
23
- equal(connectedKeys.find(n => n === target.id), undefined, 'No peer');
25
+ strictEqual(
26
+ connectedKeys.find(n => n === target.id),
27
+ undefined,
28
+ 'No peer'
29
+ );
24
30
 
25
31
  await asyncRetry({interval, times}, async () => {
26
32
  await addPeer({
@@ -40,13 +46,13 @@ test(`Add a peer`, async ({end, equal}) => {
40
46
  throw new Error('ExpectedConnectionToTarget');
41
47
  }
42
48
 
43
- equal(connected.public_key, target.id, 'Connected to remote node');
49
+ strictEqual(connected.public_key, target.id, 'Connected to remote node');
44
50
  });
45
51
  } catch (err) {
46
- equal(err, null, 'Expected no error');
52
+ strictEqual(err, null, 'Expected no error');
47
53
  } finally {
48
54
  await kill({});
49
55
  }
50
56
 
51
- return end();
57
+ return;
52
58
  });
@@ -1,17 +1,16 @@
1
+ const test = require('node:test');
2
+
1
3
  const asyncEach = require('async/each');
2
4
  const asyncRetry = require('async/retry');
3
5
  const {spawnLightningCluster} = require('ln-docker-daemons');
4
- const {test} = require('@alexbosworth/tap');
5
6
 
6
7
  const {addPeer} = require('./../../');
7
8
  const {cancelPendingChannel} = require('./../../');
8
- const {createCluster} = require('./../macros');
9
- const {delay} = require('./../macros');
10
- const {getChainBalance} = require('./../../');
11
9
  const {openChannels} = require('./../../');
12
10
 
13
11
  const capacity = 1e6;
14
12
  const count = 100;
13
+ const delay = n => new Promise(resolve => setTimeout(resolve, n));
15
14
  const interval = 100;
16
15
  const race = promises => Promise.race(promises);
17
16
  const size = 2;
@@ -19,20 +18,18 @@ const timeout = 1000 * 5;
19
18
  const times = 200;
20
19
 
21
20
  // Cancel a channel should result in no pending channels
22
- test(`Cancel pending channel`, async ({end, equal}) => {
21
+ test(`Cancel pending channel`, async () => {
23
22
  const {kill, nodes} = await spawnLightningCluster({size});
24
23
 
25
- const [control, target] = nodes;
26
-
27
- const {lnd} = control;
24
+ const [{generate, lnd}, target] = nodes;
28
25
 
29
- await control.generate({count});
30
-
31
- await addPeer({lnd, public_key: target.id, socket: target.socket});
26
+ await generate({count});
32
27
 
33
28
  const channels = [{capacity, partner_public_key: target.id}];
34
29
 
35
30
  await asyncRetry({interval, times}, async () => {
31
+ await addPeer({lnd, public_key: target.id, socket: target.socket});
32
+
36
33
  const toCancel = await race([
37
34
  delay(timeout),
38
35
  openChannels({channels, lnd}),
@@ -45,5 +42,5 @@ test(`Cancel pending channel`, async ({end, equal}) => {
45
42
 
46
43
  await kill({});
47
44
 
48
- return end();
45
+ return;
49
46
  });
@@ -1,14 +1,15 @@
1
+ const {strictEqual} = require('node:assert').strict;
2
+ const test = require('node:test');
3
+
4
+ const {setupChannel} = require('ln-docker-daemons');
1
5
  const {spawnLightningCluster} = require('ln-docker-daemons');
2
- const {test} = require('@alexbosworth/tap');
3
6
 
4
7
  const {closeChannel} = require('./../../');
5
- const {createCluster} = require('./../macros');
6
- const {setupChannel} = require('./../macros');
7
8
 
8
9
  const size = 2;
9
10
 
10
11
  // Closing a channel should close the channel
11
- test(`Close channel`, async ({end, equal}) => {
12
+ test(`Close channel`, async () => {
12
13
  const {kill, nodes} = await spawnLightningCluster({size});
13
14
 
14
15
  const [control, target] = nodes;
@@ -28,10 +29,10 @@ test(`Close channel`, async ({end, equal}) => {
28
29
  transaction_vout: channelOpen.transaction_vout,
29
30
  });
30
31
 
31
- equal(channelClose.transaction_id.length, 64, 'Force close id returned');
32
- equal(channelClose.transaction_vout, 0, 'Force close vout returned');
32
+ strictEqual(channelClose.transaction_id.length, 64, 'Got force close id');
33
+ strictEqual(channelClose.transaction_vout, 0, 'Force close vout returned');
33
34
  } catch (err) {
34
- equal(err, null, 'Expected no error force closing');
35
+ strictEqual(err, null, 'Expected no error force closing');
35
36
  }
36
37
 
37
38
  // Coop close channel using the channel id
@@ -47,13 +48,13 @@ test(`Close channel`, async ({end, equal}) => {
47
48
  lnd: control.lnd,
48
49
  });
49
50
 
50
- equal(channelClose.transaction_id.length, 64, 'Coop close id is returned');
51
- equal(channelClose.transaction_vout, 0, 'Coop close tx vout returned');
51
+ strictEqual(channelClose.transaction_id.length, 64, 'Got coop close id');
52
+ strictEqual(channelClose.transaction_vout, 0, 'Got coop close tx vout');
52
53
  } catch (err) {
53
- equal(err, null, 'Expected no error coop closing');
54
+ strictEqual(err, null, 'Expected no error coop closing');
54
55
  }
55
56
 
56
57
  await kill({});
57
58
 
58
- return end();
59
+ return;
59
60
  });
@@ -1,6 +1,8 @@
1
+ const {equal} = require('node:assert').strict;
2
+ const test = require('node:test');
3
+
1
4
  const {address} = require('bitcoinjs-lib');
2
5
  const {spawnLightningCluster} = require('ln-docker-daemons');
3
- const {test} = require('@alexbosworth/tap');
4
6
 
5
7
  const {createChainAddress} = require('./../../');
6
8
 
@@ -11,7 +13,7 @@ const prefixForV1 = 'bcrt1p';
11
13
  const regtestBech32AddressHrp = 'bcrt';
12
14
 
13
15
  // Creating addresses should result in addresses
14
- test(`Create address results in address creation`, async ({end, equal}) => {
16
+ test(`Create address results in address creation`, async () => {
15
17
  const [{kill, lnd}] = (await spawnLightningCluster({})).nodes;
16
18
 
17
19
  const createNewChainAddresses = formats
@@ -48,5 +50,5 @@ test(`Create address results in address creation`, async ({end, equal}) => {
48
50
 
49
51
  await kill({});
50
52
 
51
- return end();
53
+ return;
52
54
  });