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.
- package/CHANGELOG.md +4 -0
- package/README.md +4 -1
- package/package.json +12 -12
- package/test/autopilotrpc-integration/test_autopilot.js +30 -16
- package/test/chainrpc-integration/test_get_block.js +14 -11
- package/test/chainrpc-integration/test_get_height.js +10 -4
- package/test/chainrpc-integration/test_subscribe_to_blocks.js +10 -9
- package/test/chainrpc-integration/test_subscribe_to_chain_address.js +11 -9
- package/test/chainrpc-integration/test_subscribe_to_chain_spend.js +9 -8
- package/test/integration/test_add_peer.js +12 -6
- package/test/integration/test_cancel_pending_channel.js +9 -12
- package/test/integration/test_close_channel.js +12 -11
- package/test/integration/test_create_chain_address.js +5 -3
- package/test/integration/test_create_invoice.js +19 -15
- package/test/integration/test_decode_payment_request.js +19 -16
- package/test/integration/test_delete_payment.js +11 -30
- package/test/integration/test_delete_payments.js +8 -8
- package/test/integration/test_delete_pending_channel.js +13 -27
- package/test/integration/test_get_access_ids.js +7 -15
- package/test/integration/test_get_backup.js +12 -14
- package/test/integration/test_get_backups.js +11 -9
- package/test/integration/test_get_chain_balance.js +8 -8
- package/test/integration/test_get_chain_fee_estimate.js +8 -6
- package/test/integration/test_get_chain_transactions.js +22 -21
- package/test/integration/test_get_channel.js +19 -17
- package/test/integration/test_get_channel_balance.js +6 -4
- package/test/integration/test_get_channels.js +42 -39
- package/test/integration/test_get_closed_channels.js +95 -114
- package/test/integration/test_get_failed_payments.js +43 -42
- package/test/integration/test_get_fee_rates.js +13 -11
- package/test/integration/test_get_forwards.js +27 -24
- package/test/integration/test_get_invoice.js +31 -24
- package/test/integration/test_get_invoices.js +18 -15
- package/test/integration/test_get_methods.js +13 -16
- package/test/integration/test_get_network_centrality.js +15 -13
- package/test/integration/test_get_network_graph.js +36 -23
- package/test/integration/test_get_network_info.js +13 -11
- package/test/integration/test_get_node.js +27 -21
- package/test/integration/test_get_payments.js +20 -18
- package/test/integration/test_get_peers.js +16 -14
- package/test/integration/test_get_pending_coop.js +49 -39
- package/test/integration/test_get_pending_force.js +67 -90
- package/test/integration/test_get_pending_payments.js +23 -24
- package/test/integration/test_get_route_to_destination.js +15 -15
- package/test/integration/test_get_settlement_status.js +13 -9
- package/test/integration/test_get_utxos.js +13 -11
- package/test/integration/test_get_wallet_info.js +20 -16
- package/test/integration/test_grant_access.js +20 -23
- package/test/integration/test_open_channel.js +10 -8
- package/test/integration/test_open_channels.js +11 -10
- package/test/integration/test_pay.js +18 -27
- package/test/integration/test_pay_private_invoice.js +11 -24
- package/test/integration/test_payment_errors.js +10 -11
- package/test/integration/test_propose_channel.js +70 -105
- package/test/integration/test_push_funds.js +8 -10
- package/test/integration/test_rebalance.js +44 -32
- package/test/integration/test_recover_funds_from_channel.js +13 -11
- package/test/integration/test_recover_funds_from_channels.js +13 -11
- package/test/integration/test_remove_peer.js +8 -6
- package/test/integration/test_restrict_macaroon.js +8 -5
- package/test/integration/test_revoke_access.js +19 -24
- package/test/integration/test_send_message_to_peer.js +11 -6
- package/test/integration/test_send_to_chain_address.js +13 -12
- package/test/integration/test_send_to_chain_addresses.js +10 -8
- package/test/integration/test_sign_message.js +6 -4
- package/test/integration/test_stop_daemon.js +7 -4
- package/test/integration/test_subscribe_to_backups.js +7 -5
- package/test/integration/test_subscribe_to_channels.js +10 -21
- package/test/integration/test_subscribe_to_graph.js +17 -9
- package/test/integration/test_subscribe_to_invoices.js +10 -8
- package/test/integration/test_subscribe_to_open_requests.js +13 -12
- package/test/integration/test_subscribe_to_peer_messages.js +8 -5
- package/test/integration/test_subscribe_to_peers.js +7 -6
- package/test/integration/test_subscribe_to_rpc_requests.js +202 -191
- package/test/integration/test_subscribe_to_transactions.js +6 -4
- package/test/integration/test_trusted_funding.js +17 -11
- package/test/integration/test_update_routing_fees.js +8 -5
- package/test/integration/test_verify_access.js +8 -6
- package/test/integration/test_verify_backup.js +6 -6
- package/test/integration/test_verify_backups.js +6 -6
- package/test/integration/test_verify_message.js +5 -3
- package/test/invoicesrpc-integration/test_cancel_invoice.js +6 -5
- package/test/invoicesrpc-integration/test_get_sweep_transactions.js +6 -7
- package/test/invoicesrpc-integration/test_push_payment.js +7 -6
- package/test/invoicesrpc-integration/test_settle_invoice.js +10 -6
- package/test/invoicesrpc-integration/test_subscribe_cancel_invoice.js +8 -7
- package/test/invoicesrpc-integration/test_subscribe_settle_invoice.js +8 -7
- package/test/peersrpc-integration/test_add_external_socket.js +7 -5
- package/test/peersrpc-integration/test_remove_external_socket.js +7 -5
- package/test/peersrpc-integration/test_update_alias.js +8 -6
- package/test/peersrpc-integration/test_update_color.js +8 -6
- package/test/routerrpc-integration/test_delete_forwarding_reputations.js +8 -6
- package/test/routerrpc-integration/test_disable_channel.js +6 -4
- package/test/routerrpc-integration/test_get_forwarding_confidence.js +7 -5
- package/test/routerrpc-integration/test_get_forwarding_reputations.js +12 -7
- package/test/routerrpc-integration/test_get_pathfinding_settings.js +7 -5
- package/test/routerrpc-integration/test_get_payment.js +10 -6
- package/test/routerrpc-integration/test_get_route_confidence.js +6 -4
- package/test/routerrpc-integration/test_get_route_through_hops.js +8 -7
- package/test/routerrpc-integration/test_is_destination_payable.js +11 -8
- package/test/routerrpc-integration/test_multipath_payment.js +8 -5
- package/test/routerrpc-integration/test_pay_via_payment_details.js +11 -9
- package/test/routerrpc-integration/test_pay_via_payment_request.js +11 -7
- package/test/routerrpc-integration/test_pay_via_routes.js +8 -11
- package/test/routerrpc-integration/test_probe_for_route.js +10 -7
- package/test/routerrpc-integration/test_subscribe_to_forward_requests.js +10 -7
- package/test/routerrpc-integration/test_subscribe_to_forwards.js +23 -19
- package/test/routerrpc-integration/test_subscribe_to_past_payments.js +8 -6
- package/test/routerrpc-integration/test_subscribe_to_payments.js +18 -17
- package/test/routerrpc-integration/test_update_pathfinding_settings.js +8 -6
- package/test/runner.js +30 -0
- package/test/signerrpc-integration/test_begin_group_signing_session.js +8 -5
- package/test/signerrpc-integration/test_diffie_hellman_compute_secret.js +7 -4
- package/test/signerrpc-integration/test_sign_bytes.js +5 -3
- package/test/signerrpc-integration/test_sign_taproot.js +6 -4
- package/test/signerrpc-integration/test_sign_transaction.js +5 -3
- package/test/signerrpc-integration/test_verify_bytes_signature.js +5 -4
- package/test/tower_clientrpc-integration/test_connect_watchtower.js +7 -4
- package/test/tower_clientrpc-integration/test_get_connected_watchtowers.js +7 -4
- package/test/tower_serverrpc-integration/test_get_tower_server_info.js +6 -3
- package/test/versionrpc-integration/test_get_wallet_version.js +16 -12
- package/test/walletrpc-integration/test_broadcast_chain_transaction.js +5 -3
- package/test/walletrpc-integration/test_fund_psbt.js +5 -10
- package/test/walletrpc-integration/test_get_chain_addresses.js +9 -7
- package/test/walletrpc-integration/test_get_chain_fee_rate.js +5 -3
- package/test/walletrpc-integration/test_get_locked_utxos.js +8 -20
- package/test/walletrpc-integration/test_get_master_public_keys.js +9 -6
- package/test/walletrpc-integration/test_get_public_key.js +5 -3
- package/test/walletrpc-integration/test_lock_utxo.js +9 -5
- package/test/walletrpc-integration/test_partially_sign_psbt.js +7 -4
- package/test/walletrpc-integration/test_request_chain_fee_increase.js +8 -4
- package/test/walletrpc-integration/test_send_to_chain_output_scripts.js +7 -4
- package/test/walletrpc-integration/test_sign_chain_address_message.js +6 -6
- package/test/walletrpc-integration/test_sign_psbt.js +6 -4
- package/test/walletrpc-integration/test_unlock_utxo.js +8 -4
- package/test/walletrpc-integration/test_update_chain_transaction.js +5 -3
- package/test/walletrpc-integration/test_verify_chain_address_message.js +6 -4
- package/test/extra-integration/test_change_password.js +0 -15
- package/test/extra-integration/test_get_wallet_status.js +0 -45
- package/test/extra-integration/test_no_macaroon.js +0 -20
- package/test/extra-integration/tower_clientrpc-integration/test_disconnect_watchtower.js +0 -51
- package/test/extra-integration/tower_clientrpc-integration/test_update_connected_watchtower.js +0 -76
- package/test/grpc-integration/test_authenticated_lnd_grpc.js +0 -40
- 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 (
|
|
12
|
+
test(`Create an invoice`, async () => {
|
|
9
13
|
const [{generate, kill, lnd}] = (await spawnLightningCluster({})).nodes;
|
|
10
14
|
|
|
11
|
-
await generate({count
|
|
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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
|
|
35
|
-
|
|
38
|
+
strictEqual(code, 409, 'Got expected error code');
|
|
39
|
+
strictEqual(message, 'InvoiceWithGivenHashAlreadyExists', 'Got msg');
|
|
36
40
|
}
|
|
37
41
|
|
|
38
42
|
} catch (err) {
|
|
39
|
-
|
|
43
|
+
strictEqual(err, null, 'Expected no error in create invoice');
|
|
40
44
|
}
|
|
41
45
|
|
|
42
46
|
await kill({});
|
|
43
47
|
|
|
44
|
-
return
|
|
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 (
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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
|
-
|
|
53
|
+
strictEqual(err, null, 'Expected no error');
|
|
51
54
|
}
|
|
52
55
|
|
|
53
56
|
await kill({});
|
|
54
57
|
|
|
55
|
-
return
|
|
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 (
|
|
16
|
+
test('Delete payment', async () => {
|
|
15
17
|
const {kill, nodes} = await spawnLightningCluster({size});
|
|
16
18
|
|
|
17
|
-
const [
|
|
18
|
-
|
|
19
|
-
const {lnd} = control;
|
|
19
|
+
const [{generate, lnd}, target] = nodes;
|
|
20
20
|
|
|
21
|
-
await setupChannel({
|
|
21
|
+
await setupChannel({generate, lnd, to: target});
|
|
22
22
|
|
|
23
23
|
const invoice = await createInvoice({tokens, lnd: target.lnd});
|
|
24
24
|
|
|
25
|
-
|
|
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
|
-
|
|
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
|
-
|
|
33
|
+
strictEqual(priorLength - wipedLength, [paid].length, 'Payment deleted');
|
|
53
34
|
|
|
54
35
|
await kill({});
|
|
55
36
|
|
|
56
|
-
return
|
|
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 (
|
|
18
|
+
test('Delete payments', async () => {
|
|
17
19
|
const {kill, nodes} = await spawnLightningCluster({size});
|
|
18
20
|
|
|
19
|
-
const [
|
|
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
|
-
|
|
37
|
+
strictEqual(priorLength - wipedLength, [paid].length, 'History deleted');
|
|
38
38
|
|
|
39
39
|
await kill({});
|
|
40
40
|
|
|
41
|
-
return
|
|
41
|
+
return;
|
|
42
42
|
});
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
const {
|
|
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 (
|
|
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 [
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
176
|
+
deepStrictEqual(notPending, undefined, 'Conflicting pending deleted');
|
|
191
177
|
} catch (err) {
|
|
192
|
-
|
|
178
|
+
deepStrictEqual(err, [501, 'DeletePendingChannelMethodNotSupported']);
|
|
193
179
|
}
|
|
194
180
|
} catch (err) {
|
|
195
|
-
|
|
196
|
-
} finally {
|
|
197
|
-
await kill({});
|
|
181
|
+
deepStrictEqual(err, null, 'No error is expected');
|
|
198
182
|
}
|
|
199
183
|
|
|
200
|
-
|
|
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 (
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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 (
|
|
13
|
+
test(`Get channel backup`, async () => {
|
|
12
14
|
const {kill, nodes} = await spawnLightningCluster({size});
|
|
13
15
|
|
|
14
|
-
const [
|
|
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
|
|
21
|
+
lnd,
|
|
24
22
|
transaction_id: channel.transaction_id,
|
|
25
23
|
transaction_vout: channel.transaction_vout,
|
|
26
24
|
});
|
|
27
25
|
|
|
28
|
-
|
|
26
|
+
deepStrictEqual(!!backup, true, 'Channel backup is returned');
|
|
29
27
|
|
|
30
28
|
const channelBackup = await verifyBackup({
|
|
31
29
|
backup,
|
|
32
|
-
lnd
|
|
30
|
+
lnd,
|
|
33
31
|
transaction_id: channel.transaction_id,
|
|
34
32
|
transaction_vout: channel.transaction_vout,
|
|
35
33
|
});
|
|
36
34
|
|
|
37
|
-
|
|
35
|
+
deepStrictEqual(channelBackup.is_valid, true, 'Is a valid backup');
|
|
38
36
|
|
|
39
37
|
await kill({});
|
|
40
38
|
|
|
41
|
-
return
|
|
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 (
|
|
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
|
-
|
|
22
|
-
|
|
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
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
|
37
|
+
return;
|
|
36
38
|
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
const
|
|
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
|
-
|
|
22
|
+
strictEqual(result.chain_balance, emptyChainBalance, 'Got chain balance');
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
// Generate some funds for LND
|
|
26
|
-
await generate({count
|
|
26
|
+
await generate({count});
|
|
27
27
|
|
|
28
28
|
// Check that the balance is updated
|
|
29
29
|
const postDeposit = await getChainBalance({lnd});
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
strictEqual(postDeposit.chain_balance >= tokens, true, 'Got funds');
|
|
32
32
|
|
|
33
33
|
await kill({});
|
|
34
34
|
|
|
35
|
-
return
|
|
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 (
|
|
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
|
-
|
|
46
|
+
strictEqual(estimate.fee, 8650, 'Total fee is estimated');
|
|
45
47
|
} else {
|
|
46
|
-
|
|
48
|
+
strictEqual(estimate.fee, expectedFee, 'Total fee is estimated');
|
|
47
49
|
}
|
|
48
50
|
|
|
49
|
-
|
|
51
|
+
strictEqual(estimate.tokens_per_vbyte, expectedFeeRate, 'Got fee per vbyte');
|
|
50
52
|
|
|
51
53
|
await kill({});
|
|
52
54
|
|
|
53
|
-
return
|
|
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 (
|
|
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:
|
|
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
|
-
|
|
51
|
+
strictEqual(transactions.length > 1, true, 'Transaction found');
|
|
51
52
|
|
|
52
53
|
const [tx] = transactions;
|
|
53
54
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
89
|
+
strictEqual(between.transactions.length, [tx].length, 'One transaction');
|
|
89
90
|
|
|
90
91
|
await kill({});
|
|
91
92
|
|
|
92
|
-
return
|
|
93
|
+
return;
|
|
93
94
|
});
|