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
@@ -1,28 +1,32 @@
1
+ const {strictEqual} = require('node:assert').strict;
2
+ const test = require('node:test');
3
+
1
4
  const {spawnLightningCluster} = require('ln-docker-daemons');
2
- const {test} = require('@alexbosworth/tap');
3
5
 
4
6
  const {createInvoice} = require('./../../');
5
7
  const {parsePaymentRequest} = require('./../../');
6
8
 
9
+ const count = 100;
10
+
7
11
  // createInvoice should result in a created invoice
8
- test(`Create an invoice`, async ({end, equal}) => {
12
+ test(`Create an invoice`, async () => {
9
13
  const [{generate, kill, lnd}] = (await spawnLightningCluster({})).nodes;
10
14
 
11
- await generate({count: 100});
15
+ await generate({count});
12
16
 
13
17
  try {
14
18
  const invoice = await createInvoice({lnd});
15
19
 
16
20
  const parsed = parsePaymentRequest({request: invoice.request});
17
21
 
18
- equal(invoice.chain_address, undefined, 'Default address is undefined');
19
- equal(invoice.created_at, parsed.created_at, 'Invoice has created date');
20
- equal(invoice.description, undefined, 'Default description is undefined');
21
- equal(invoice.id, parsed.id, 'Invoice has id');
22
- equal(invoice.mtokens, '0', 'Default mtokens are 0');
23
- equal(!!invoice.request, true, 'Invoice has request');
24
- equal(!!invoice.secret, true, 'Invoice returns secret');
25
- equal(invoice.tokens, 0, 'Default tokens are 0');
22
+ strictEqual(invoice.chain_address, undefined, 'Address is undefined');
23
+ strictEqual(invoice.created_at, parsed.created_at, 'Invoice created date');
24
+ strictEqual(invoice.description, undefined, 'Description undefined');
25
+ strictEqual(invoice.id, parsed.id, 'Invoice has id');
26
+ strictEqual(invoice.mtokens, '0', 'Default mtokens are 0');
27
+ strictEqual(!!invoice.request, true, 'Invoice has request');
28
+ strictEqual(!!invoice.secret, true, 'Invoice returns secret');
29
+ strictEqual(invoice.tokens, 0, 'Default tokens are 0');
26
30
 
27
31
  try {
28
32
  const duplicate = await createInvoice({lnd, secret: invoice.secret});
@@ -31,15 +35,15 @@ test(`Create an invoice`, async ({end, equal}) => {
31
35
  } catch (err) {
32
36
  const [code, message] = err;
33
37
 
34
- equal(code, 409, 'Got expected error code');
35
- equal(message, 'InvoiceWithGivenHashAlreadyExists', 'Got expected msg');
38
+ strictEqual(code, 409, 'Got expected error code');
39
+ strictEqual(message, 'InvoiceWithGivenHashAlreadyExists', 'Got msg');
36
40
  }
37
41
 
38
42
  } catch (err) {
39
- equal(err, null, 'Expected no error in create invoice');
43
+ strictEqual(err, null, 'Expected no error in create invoice');
40
44
  }
41
45
 
42
46
  await kill({});
43
47
 
44
- return end();
48
+ return;
45
49
  });
@@ -1,5 +1,7 @@
1
+ const {strictEqual} = require('node:assert').strict;
2
+ const test = require('node:test');
3
+
1
4
  const {spawnLightningCluster} = require('ln-docker-daemons');
2
- const {test} = require('@alexbosworth/tap');
3
5
 
4
6
  const {createInvoice} = require('./../../');
5
7
  const {decodePaymentRequest} = require('./../../');
@@ -21,7 +23,7 @@ const tests = [
21
23
  ];
22
24
 
23
25
  tests.forEach(({description, expected}) => {
24
- return test(description, async ({end, equal}) => {
26
+ return test(description, async () => {
25
27
  const [{kill, lnd}] = (await spawnLightningCluster({})).nodes;
26
28
 
27
29
  try {
@@ -34,24 +36,25 @@ tests.forEach(({description, expected}) => {
34
36
  });
35
37
 
36
38
  const decoded = await decodePaymentRequest({lnd, request});
37
-
38
- equal(decoded.chain_addresses, expected.chain_addresses, 'Chain addr');
39
- equal(decoded.cltv_delta, expected.cltv_delta, 'Decode cltv delta');
40
- equal(!!decoded.created_at, true, 'Created at date');
41
- equal(decoded.description, expected.description, 'Decode description');
42
- equal(decoded.description_hash, expected.description_hash, 'Desc hash');
43
- equal(decoded.destination, (await getIdentity({lnd})).public_key, 'Pk');
44
- equal(!!decoded.expires_at, true, 'Expiration date decoded');
45
- equal(decoded.id, expected.id, 'Decoded payment hash');
46
- equal(decoded.mtokens, expected.mtokens, 'Decode millitokens');
47
- equal(decoded.safe_tokens, expected.safe_tokens, 'Decode safe amount');
48
- equal(decoded.tokens, expected.tokens, 'Decode tokens amount');
39
+ const identity = (await getIdentity({lnd})).public_key;
40
+
41
+ strictEqual(decoded.chain_addresses, expected.chain_addresses, 'Addr');
42
+ strictEqual(decoded.cltv_delta, expected.cltv_delta, 'Decode cltv');
43
+ strictEqual(!!decoded.created_at, true, 'Created at date');
44
+ strictEqual(decoded.description, expected.description, 'Decode desc');
45
+ strictEqual(decoded.description_hash, expected.description_hash, 'Hash');
46
+ strictEqual(decoded.destination, identity, 'Got public key');
47
+ strictEqual(!!decoded.expires_at, true, 'Expiration date decoded');
48
+ strictEqual(decoded.id, expected.id, 'Decoded payment hash');
49
+ strictEqual(decoded.mtokens, expected.mtokens, 'Decode millitokens');
50
+ strictEqual(decoded.safe_tokens, expected.safe_tokens, 'Safe amount');
51
+ strictEqual(decoded.tokens, expected.tokens, 'Decode tokens amount');
49
52
  } catch (err) {
50
- equal(err, null, 'Expected no error');
53
+ strictEqual(err, null, 'Expected no error');
51
54
  }
52
55
 
53
56
  await kill({});
54
57
 
55
- return end();
58
+ return;
56
59
  });
57
60
  });
@@ -1,57 +1,38 @@
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 {createInvoice} = require('./../../');
5
8
  const {deletePayment} = require('./../../');
6
9
  const {getPayments} = require('./../../');
7
10
  const {pay} = require('./../../');
8
- const {setupChannel} = require('./../macros');
9
11
 
10
12
  const size = 2;
11
13
  const tokens = 100;
12
14
 
13
15
  // Deleting a payment should delete the payment record
14
- test('Delete payment', async ({afterEach, fail, end, equal, strictSame}) => {
16
+ test('Delete payment', async () => {
15
17
  const {kill, nodes} = await spawnLightningCluster({size});
16
18
 
17
- const [control, target] = nodes;
18
-
19
- const {lnd} = control;
19
+ const [{generate, lnd}, target] = nodes;
20
20
 
21
- await setupChannel({lnd, generate: control.generate, to: target});
21
+ await setupChannel({generate, lnd, to: target});
22
22
 
23
23
  const invoice = await createInvoice({tokens, lnd: target.lnd});
24
24
 
25
- let paid;
26
-
27
- try {
28
- paid = await pay({lnd, request: invoice.request});
29
- } catch (err) {
30
- fail('Payment should be made to destination');
31
-
32
- await kill({});
33
-
34
- return end();
35
- }
25
+ const paid = await pay({lnd, request: invoice.request});
36
26
 
37
27
  const priorLength = (await getPayments({lnd})).payments.length;
38
28
 
39
- // LND 0.13.4 and below do not support deletePayment
40
- try {
41
- await deletePayment({lnd, id: invoice.id});
42
- } catch (err) {
43
- strictSame(err, [501, 'DeletePaymentMethodNotSupported']);
44
-
45
- await kill({});
46
-
47
- return end();
48
- }
29
+ await deletePayment({lnd, id: invoice.id});
49
30
 
50
31
  const wipedLength = (await getPayments({lnd})).payments.length;
51
32
 
52
- equal(priorLength - wipedLength, [paid].length, 'Payment deleted');
33
+ strictEqual(priorLength - wipedLength, [paid].length, 'Payment deleted');
53
34
 
54
35
  await kill({});
55
36
 
56
- return end();
37
+ return;
57
38
  });
@@ -1,24 +1,24 @@
1
+ const {strictEqual} = require('node:assert').strict;
2
+ const test = require('node:test');
3
+
1
4
  const asyncRetry = require('async/retry');
5
+ const {setupChannel} = require('ln-docker-daemons');
2
6
  const {spawnLightningCluster} = require('ln-docker-daemons');
3
- const {test} = require('@alexbosworth/tap');
4
7
 
5
8
  const {createInvoice} = require('./../../');
6
9
  const {deletePayments} = require('./../../');
7
10
  const {getPayments} = require('./../../');
8
11
  const {pay} = require('./../../');
9
- const {setupChannel} = require('./../macros');
10
12
 
11
13
  const size = 2;
12
14
  const times = 1000;
13
15
  const tokens = 100;
14
16
 
15
17
  // Deleting payments should delete all payments
16
- test('Delete payments', async ({afterEach, fail, end, equal}) => {
18
+ test('Delete payments', async () => {
17
19
  const {kill, nodes} = await spawnLightningCluster({size});
18
20
 
19
- const [control, target] = nodes;
20
-
21
- const {generate, lnd} = control;
21
+ const [{generate, lnd}, target] = nodes;
22
22
 
23
23
  await setupChannel({generate, lnd, to: target});
24
24
 
@@ -34,9 +34,9 @@ test('Delete payments', async ({afterEach, fail, end, equal}) => {
34
34
 
35
35
  const wipedLength = (await getPayments({lnd})).payments.length;
36
36
 
37
- equal(priorLength - wipedLength, [paid].length, 'Payment history deleted');
37
+ strictEqual(priorLength - wipedLength, [paid].length, 'History deleted');
38
38
 
39
39
  await kill({});
40
40
 
41
- return end();
41
+ return;
42
42
  });
@@ -1,18 +1,16 @@
1
- const {once} = require('events');
1
+ const {deepStrictEqual} = require('node:assert').strict;
2
+ const test = require('node:test');
2
3
 
3
4
  const asyncEach = require('async/each');
4
5
  const asyncRetry = require('async/retry');
5
6
  const asyncTimeout = require('async/timeout');
6
7
  const {extractTransaction} = require('psbt');
7
8
  const {spawnLightningCluster} = require('ln-docker-daemons');
8
- const {test} = require('@alexbosworth/tap');
9
9
  const tinysecp = require('tiny-secp256k1');
10
10
 
11
11
  const {addPeer} = require('./../../');
12
12
  const {broadcastChainTransaction} = require('./../../');
13
13
  const {cancelPendingChannel} = require('./../../');
14
- const {createCluster} = require('./../macros');
15
- const {delay} = require('./../macros');
16
14
  const {deletePendingChannel} = require('./../../');
17
15
  const {fundPendingChannels} = require('./../../');
18
16
  const {fundPsbt} = require('./../../');
@@ -27,6 +25,7 @@ const {unlockUtxo} = require('./../../');
27
25
 
28
26
  const capacity = 1e6;
29
27
  const count = 100;
28
+ const delay = n => new Promise(resolve => setTimeout(resolve, n));
30
29
  const description = 'description';
31
30
  const interval = 100;
32
31
  const race = promises => Promise.race(promises);
@@ -35,28 +34,15 @@ const timeout = 1000 * 20;
35
34
  const times = 2000;
36
35
 
37
36
  // Forfeiting a pending channel should remove the pending channel
38
- test(`Forfeit pending channel`, async ({end, equal, strictSame}) => {
37
+ test(`Forfeit pending channel`, async () => {
39
38
  const ecp = (await import('ecpair')).ECPairFactory(tinysecp);
40
39
 
41
40
  const {kill, nodes} = await spawnLightningCluster({size});
42
41
 
43
- const [control, target, remote] = nodes;
44
-
45
- const {generate, lnd} = control;
46
-
47
- try {
48
- const {keys} = await getMasterPublicKeys({lnd});
49
- } catch (err) {
50
- // LND 0.13.3 and below should not be tested
51
- strictSame(err, [501, 'GetMasterPublicKeysMethodNotSupported'], 'Got err');
52
-
53
- await kill({});
54
-
55
- return end();
56
- }
42
+ const [{generate, lnd}, target, remote] = nodes;
57
43
 
58
44
  try {
59
- await control.generate({count});
45
+ await generate({count});
60
46
 
61
47
  await asyncEach([target, remote], async node => {
62
48
  return await addPeer({lnd, public_key: node.id, socket: node.socket});
@@ -174,7 +160,7 @@ test(`Forfeit pending channel`, async ({end, equal, strictSame}) => {
174
160
  } catch (err) {
175
161
  const [code] = err;
176
162
 
177
- equal(code, 503, 'Pending channel cannot be canceled');
163
+ deepStrictEqual(code, 503, 'Pending channel cannot be canceled');
178
164
  }
179
165
 
180
166
  try {
@@ -187,15 +173,15 @@ test(`Forfeit pending channel`, async ({end, equal, strictSame}) => {
187
173
 
188
174
  const [notPending] = (await getPendingChannels({lnd})).pending_channels;
189
175
 
190
- equal(notPending, undefined, 'Conflicting pending channel deleted');
176
+ deepStrictEqual(notPending, undefined, 'Conflicting pending deleted');
191
177
  } catch (err) {
192
- strictSame(err, [501, 'DeletePendingChannelMethodNotSupported']);
178
+ deepStrictEqual(err, [501, 'DeletePendingChannelMethodNotSupported']);
193
179
  }
194
180
  } catch (err) {
195
- equal(err, null, 'No error is expected');
196
- } finally {
197
- await kill({});
181
+ deepStrictEqual(err, null, 'No error is expected');
198
182
  }
199
183
 
200
- return end();
184
+ await kill({});
185
+
186
+ return;
201
187
  });
@@ -1,35 +1,27 @@
1
+ const {deepStrictEqual} = require('node:assert').strict;
2
+ const test = require('node:test');
3
+
1
4
  const {spawnLightningCluster} = require('ln-docker-daemons');
2
- const {test} = require('@alexbosworth/tap');
3
5
 
4
6
  const {getAccessIds} = require('./../../');
5
7
  const {grantAccess} = require('./../../');
6
- const {spawnLnd} = require('./../macros');
7
8
 
8
9
  const defaultId = '0';
9
10
  const id = '1';
10
11
 
11
12
  // Getting access ids should return root macaroon ids
12
- test(`Get access ids`, async ({end, equal, rejects, strictSame}) => {
13
+ test(`Get access ids`, async () => {
13
14
  const {kill, nodes} = await spawnLightningCluster({});
14
15
 
15
16
  const [{lnd}] = nodes;
16
17
 
17
18
  await grantAccess({id, lnd, is_ok_to_create_chain_addresses: true});
18
19
 
19
- try {
20
- const {ids} = await getAccessIds({lnd});
21
-
22
- strictSame(ids, [defaultId, id], 'Got expected access ids');
23
- } catch (err) {
24
- const [, type] = err;
20
+ const {ids} = await getAccessIds({lnd});
25
21
 
26
- // Ignore failures on LND 0.11.0 and below
27
- if (type !== 'ListRootMacaroonIdsMethodNotSupported') {
28
- throw err;
29
- }
30
- }
22
+ deepStrictEqual(ids, [defaultId, id], 'Got expected access ids');
31
23
 
32
24
  await kill({});
33
25
 
34
- return end();
26
+ return;
35
27
  });
@@ -1,42 +1,40 @@
1
+ const {deepStrictEqual} = 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 {getBackup} = require('./../../');
5
- const {setupChannel} = require('./../macros');
6
8
  const {verifyBackup} = require('./../../');
7
9
 
8
10
  const size = 2;
9
11
 
10
12
  // Getting a channel backup should return a channel backup
11
- test(`Get channel backup`, async ({end, equal}) => {
13
+ test(`Get channel backup`, async () => {
12
14
  const {kill, nodes} = await spawnLightningCluster({size});
13
15
 
14
- const [control, target] = nodes;
16
+ const [{generate, lnd}, target] = nodes;
15
17
 
16
- const channel = await setupChannel({
17
- generate: control.generate,
18
- lnd: control.lnd,
19
- to: target,
20
- });
18
+ const channel = await setupChannel({generate, lnd, to: target});
21
19
 
22
20
  const {backup} = await getBackup({
23
- lnd: control.lnd,
21
+ lnd,
24
22
  transaction_id: channel.transaction_id,
25
23
  transaction_vout: channel.transaction_vout,
26
24
  });
27
25
 
28
- equal(!!backup, true, 'Channel backup is returned');
26
+ deepStrictEqual(!!backup, true, 'Channel backup is returned');
29
27
 
30
28
  const channelBackup = await verifyBackup({
31
29
  backup,
32
- lnd: control.lnd,
30
+ lnd,
33
31
  transaction_id: channel.transaction_id,
34
32
  transaction_vout: channel.transaction_vout,
35
33
  });
36
34
 
37
- equal(channelBackup.is_valid, true, 'Channel backup is a valid backup');
35
+ deepStrictEqual(channelBackup.is_valid, true, 'Is a valid backup');
38
36
 
39
37
  await kill({});
40
38
 
41
- return end();
39
+ return;
42
40
  });
@@ -1,14 +1,16 @@
1
+ const {strictEqual} = require('node:assert').strict;
2
+ const test = require('node:test');
3
+
1
4
  const asyncRetry = require('async/retry');
5
+ const {setupChannel} = require('ln-docker-daemons');
2
6
  const {spawnLightningCluster} = require('ln-docker-daemons');
3
- const {test} = require('@alexbosworth/tap');
4
7
 
5
8
  const {getBackups} = require('./../../');
6
- const {setupChannel} = require('./../macros');
7
9
 
8
10
  const size = 2;
9
11
 
10
12
  // Getting a set of channel backups should return channel backups
11
- test(`Get channel backup`, async ({end, equal}) => {
13
+ test(`Get channel backup`, async () => {
12
14
  await asyncRetry({}, async () => {
13
15
  const {kill, nodes} = await spawnLightningCluster({size});
14
16
 
@@ -18,19 +20,19 @@ test(`Get channel backup`, async ({end, equal}) => {
18
20
 
19
21
  const {backup, channels} = await getBackups({lnd});
20
22
 
21
- equal(!!backup, true, 'Multi-backup blob is returned');
22
- equal(channels.length, [channel].length, 'Individualized channel backup');
23
+ strictEqual(!!backup, true, 'Multi-backup blob is returned');
24
+ strictEqual(channels.length, [channel].length, 'Individualized backup');
23
25
 
24
26
  const [chanBackup] = channels;
25
27
 
26
- equal(!!chanBackup.backup.length, true, 'Channel backup has its own blob');
27
- equal(chanBackup.transaction_id, channel.transaction_id, 'Chan tx id');
28
- equal(chanBackup.transaction_vout, channel.transaction_vout, 'Chan vout');
28
+ strictEqual(!!chanBackup.backup.length, true, 'Channel backup has blob');
29
+ strictEqual(chanBackup.transaction_id, channel.transaction_id, 'Chan id');
30
+ strictEqual(chanBackup.transaction_vout, channel.transaction_vout, 'Vout');
29
31
 
30
32
  await kill({});
31
33
 
32
34
  return;
33
35
  });
34
36
 
35
- return end();
37
+ return;
36
38
  });
@@ -1,12 +1,12 @@
1
- const asyncRetry = require('async/retry');
1
+ const {strictEqual} = require('node:assert').strict;
2
+ const test = require('node:test');
3
+
2
4
  const {spawnLightningCluster} = require('ln-docker-daemons');
3
- const {test} = require('@alexbosworth/tap');
4
5
 
5
6
  const {getChainBalance} = require('./../../');
6
7
 
8
+ const count = 100;
7
9
  const emptyChainBalance = 0;
8
- const interval = 1;
9
- const times = 150;
10
10
  const tokens = 5000000000;
11
11
 
12
12
  // Getting chain balance should result in a chain balance
@@ -19,18 +19,18 @@ test(`Get the chain balance`, async ({end, equal}) => {
19
19
  {
20
20
  const result = await getChainBalance({lnd});
21
21
 
22
- equal(result.chain_balance, emptyChainBalance, 'Valid chain balance');
22
+ strictEqual(result.chain_balance, emptyChainBalance, 'Got chain balance');
23
23
  }
24
24
 
25
25
  // Generate some funds for LND
26
- await generate({count: 100});
26
+ await generate({count});
27
27
 
28
28
  // Check that the balance is updated
29
29
  const postDeposit = await getChainBalance({lnd});
30
30
 
31
- equal(postDeposit.chain_balance >= tokens, true, 'Got funds');
31
+ strictEqual(postDeposit.chain_balance >= tokens, true, 'Got funds');
32
32
 
33
33
  await kill({});
34
34
 
35
- return end();
35
+ return;
36
36
  });
@@ -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 {createChainAddress} = require('./../../');
6
8
  const {getChainBalance} = require('./../../');
@@ -14,7 +16,7 @@ const times = 200;
14
16
  const tokens = 1e6;
15
17
 
16
18
  // Getting a chain fee estimate should return an estimate of the chain fee
17
- test(`Get chain fee estimate`, async ({end, equal}) => {
19
+ test(`Get chain fee estimate`, async () => {
18
20
  const {kill, nodes} = await spawnLightningCluster({size});
19
21
 
20
22
  const [control, {lnd}] = nodes;
@@ -41,14 +43,14 @@ test(`Get chain fee estimate`, async ({end, equal}) => {
41
43
 
42
44
  // LND 0.15.4 and below uses P2WPKH as change
43
45
  if (estimate.fee === 8650) {
44
- equal(estimate.fee, 8650, 'Total fee is estimated');
46
+ strictEqual(estimate.fee, 8650, 'Total fee is estimated');
45
47
  } else {
46
- equal(estimate.fee, expectedFee, 'Total fee is estimated');
48
+ strictEqual(estimate.fee, expectedFee, 'Total fee is estimated');
47
49
  }
48
50
 
49
- equal(estimate.tokens_per_vbyte, expectedFeeRate, 'Fee per vbyte is given');
51
+ strictEqual(estimate.tokens_per_vbyte, expectedFeeRate, 'Got fee per vbyte');
50
52
 
51
53
  await kill({});
52
54
 
53
- return end();
55
+ return;
54
56
  });
@@ -1,8 +1,9 @@
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
- const {getChainBalance} = require('./../../');
6
7
  const {getChainTransactions} = require('./../../');
7
8
  const {getWalletInfo} = require('./../../');
8
9
 
@@ -12,7 +13,7 @@ const format = 'np2wpkh';
12
13
  const times = 300;
13
14
 
14
15
  // Getting chain transactions should list out the chain transactions
15
- test(`Get chain transactions`, async ({end, equal, strictSame}) => {
16
+ test(`Get chain transactions`, async () => {
16
17
  const {kill, nodes} = await spawnLightningCluster({});
17
18
 
18
19
  const [{generate, lnd}] = nodes;
@@ -20,7 +21,7 @@ test(`Get chain transactions`, async ({end, equal, strictSame}) => {
20
21
  // Generate some funds for LND
21
22
  await generate({count});
22
23
 
23
- await asyncRetry({interval: 10, times: 3000}, async () => {
24
+ await asyncRetry({interval: 10, times: 6000}, async () => {
24
25
  const wallet = await getWalletInfo({lnd});
25
26
 
26
27
  if (!wallet.is_synced_to_chain) {
@@ -47,29 +48,29 @@ test(`Get chain transactions`, async ({end, equal, strictSame}) => {
47
48
 
48
49
  const {transactions} = await getChainTransactions({lnd});
49
50
 
50
- equal(transactions.length > 1, true, 'Transaction found');
51
+ strictEqual(transactions.length > 1, true, 'Transaction found');
51
52
 
52
53
  const [tx] = transactions;
53
54
 
54
- equal(!!tx.block_id, true, 'Transaction has block id');
55
- equal(!!tx.confirmation_count, true, 'Transaction confirm count');
56
- equal(!!tx.confirmation_height, true, 'Transaction confirm height');
57
- equal(!!tx.created_at, true, 'Transaction record create time');
58
- equal(tx.description, undefined, 'No tx description');
59
- equal(tx.fee, undefined, 'No transaction fee');
60
- equal(!!tx.id, true, 'Transaction id');
61
- equal(tx.is_confirmed, true, 'Transaction is confirmed');
62
- equal(tx.is_outgoing, false, 'Transaction is incoming');
63
- equal(tx.output_addresses.length, 1, 'Tx output address');
64
- equal(tx.tokens, 5000000000, 'Got coinbase reward tokens');
65
- equal(!!tx.transaction, true, 'Got transaction hex');
55
+ strictEqual(!!tx.block_id, true, 'Transaction has block id');
56
+ strictEqual(!!tx.confirmation_count, true, 'Transaction confirm count');
57
+ strictEqual(!!tx.confirmation_height, true, 'Transaction confirm height');
58
+ strictEqual(!!tx.created_at, true, 'Transaction record create time');
59
+ strictEqual(tx.description, undefined, 'No tx description');
60
+ strictEqual(tx.fee, undefined, 'No transaction fee');
61
+ strictEqual(!!tx.id, true, 'Transaction id');
62
+ strictEqual(tx.is_confirmed, true, 'Transaction is confirmed');
63
+ strictEqual(tx.is_outgoing, false, 'Transaction is incoming');
64
+ strictEqual(tx.output_addresses.length, 1, 'Tx output address');
65
+ strictEqual(tx.tokens, 5000000000, 'Got coinbase reward tokens');
66
+ strictEqual(!!tx.transaction, true, 'Got transaction hex');
66
67
 
67
68
  const onlyAfter = await getChainTransactions({
68
69
  lnd,
69
70
  after: tx.confirmation_height,
70
71
  });
71
72
 
72
- equal(onlyAfter.transactions.length, [].length, 'No transactions after');
73
+ strictEqual(onlyAfter.transactions.length, [].length, 'No txs after');
73
74
 
74
75
  const [height] = transactions
75
76
  .map(n => n.confirmation_height)
@@ -77,7 +78,7 @@ test(`Get chain transactions`, async ({end, equal, strictSame}) => {
77
78
 
78
79
  const onlyBefore = await getChainTransactions({lnd, before: height});
79
80
 
80
- equal(onlyBefore.transactions.length, [].length, 'No tx before');
81
+ strictEqual(onlyBefore.transactions.length, [].length, 'No tx before');
81
82
 
82
83
  const between = await getChainTransactions({
83
84
  lnd,
@@ -85,9 +86,9 @@ test(`Get chain transactions`, async ({end, equal, strictSame}) => {
85
86
  before: tx.confirmation_height + 1,
86
87
  });
87
88
 
88
- strictSame(between.transactions.length, [tx].length, 'One transaction');
89
+ strictEqual(between.transactions.length, [tx].length, 'One transaction');
89
90
 
90
91
  await kill({});
91
92
 
92
- return end();
93
+ return;
93
94
  });