ln-service 53.0.1 → 53.2.0
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 +13 -0
- package/README.md +18 -9
- package/package.json +5 -5
- package/test/integration/test_get_pending_coop.js +1 -0
- package/test/integration/test_get_pending_force.js +3 -0
- package/test/integration/test_open_channels.js +34 -14
- package/test/integration/test_propose_channel.js +1 -0
- package/test/integration/test_subscribe_to_peers.js +9 -2
- package/test/routerrpc-integration/test_multipath_payment.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Versions
|
|
2
2
|
|
|
3
|
+
## 54.2.0
|
|
4
|
+
|
|
5
|
+
- `getPendingChannels`: Add support for channel `capacity`
|
|
6
|
+
|
|
7
|
+
## 53.1.2
|
|
8
|
+
|
|
9
|
+
- `openChannels`: Fix `cooperative_close_address` not being set on channels
|
|
10
|
+
|
|
11
|
+
## 53.1.0
|
|
12
|
+
|
|
13
|
+
- Add support for LND 0.14.1
|
|
14
|
+
- `openChannels`: Add `is_avoiding_broadcast` to avoid all funding broadcast
|
|
15
|
+
|
|
3
16
|
## 53.0.1
|
|
4
17
|
|
|
5
18
|
- Removed support for determining the type of channel to support LND 0.14.0.
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ through npm.
|
|
|
9
9
|
|
|
10
10
|
Supported LND versions:
|
|
11
11
|
|
|
12
|
-
- v0.14.0-beta
|
|
12
|
+
- v0.14.0-beta to v0.14.1-beta
|
|
13
13
|
- v0.13.0-beta to v0.13.4-beta
|
|
14
14
|
- v0.12.0-beta to v0.12.1-beta
|
|
15
15
|
- v0.11.0-beta to v0.11.1-beta
|
|
@@ -74,8 +74,8 @@ the LND directory. (~/.lnd or ~/Library/Application Support/Lnd)
|
|
|
74
74
|
|
|
75
75
|
Be careful to avoid copying any newline characters in creds. To exclude them:
|
|
76
76
|
|
|
77
|
-
base64 ~/.lnd/tls.cert
|
|
78
|
-
base64 ~/.lnd/data/chain/bitcoin/mainnet/admin.macaroon
|
|
77
|
+
base64 -w0 ~/.lnd/tls.cert
|
|
78
|
+
base64 -w0 ~/.lnd/data/chain/bitcoin/mainnet/admin.macaroon
|
|
79
79
|
|
|
80
80
|
You can then use these to interact with your LND node directly:
|
|
81
81
|
|
|
@@ -249,9 +249,13 @@ for `unlocker` methods.
|
|
|
249
249
|
- [bolt07](https://npmjs.com/package/bolt07) - bolt07 channel gossip utilities
|
|
250
250
|
- [bolt09](https://npmjs.com/package/bolt09) - bolt09 feature flag utilities
|
|
251
251
|
- [invoices](https://npmjs.com/package/invoices) - bolt11 request utilities
|
|
252
|
-
- [lightning](https://npmjs.com/package/lightning) -
|
|
252
|
+
- [lightning](https://npmjs.com/package/lightning) - methods with typescript
|
|
253
|
+
typing support
|
|
253
254
|
- [ln-accounting](https://npmjs.com/package/ln-accounting) - accounting records
|
|
254
|
-
- [ln-
|
|
255
|
+
- [ln-docker-daemons](https://github.com/alexbosworth/ln-docker-daemons)
|
|
256
|
+
- run regtest integration tests
|
|
257
|
+
- [ln-pathfinding](https://npmjs.com/package/ln-accounting) - pathfinding
|
|
258
|
+
utilities
|
|
255
259
|
- [probing](https://npmjs.com/package/probing) - payment probing utilities
|
|
256
260
|
- [psbt](https://www.npmjs.com/package/psbt) - BIP 174 PSBT utilities
|
|
257
261
|
|
|
@@ -2531,6 +2535,7 @@ Requires `offchain:read` permission
|
|
|
2531
2535
|
@returns via cbk or Promise
|
|
2532
2536
|
{
|
|
2533
2537
|
pending_channels: [{
|
|
2538
|
+
capacity: <Channel Capacity Tokens Number>
|
|
2534
2539
|
[close_transaction_id]: <Channel Closing Transaction Id String>
|
|
2535
2540
|
is_active: <Channel Is Active Bool>
|
|
2536
2541
|
is_closing: <Channel Is Closing Bool>
|
|
@@ -3201,11 +3206,11 @@ Requires `offchain:write`, `onchain:write`, `peers:write` permissions
|
|
|
3201
3206
|
[give_tokens]: <Tokens to Gift To Partner Number> // Defaults to zero
|
|
3202
3207
|
[is_private]: <Channel is Private Bool> // Defaults to false
|
|
3203
3208
|
lnd: <Authenticated LND API Object>
|
|
3204
|
-
local_tokens: <
|
|
3209
|
+
local_tokens: <Total Channel Capacity Tokens Number>
|
|
3205
3210
|
[min_confirmations]: <Spend UTXOs With Minimum Confirmations Number>
|
|
3206
3211
|
[min_htlc_mtokens]: <Minimum HTLC Millitokens String>
|
|
3207
|
-
partner_public_key: <Public Key Hex String>
|
|
3208
3212
|
[partner_csv_delay]: <Peer Output CSV Delay Number>
|
|
3213
|
+
partner_public_key: <Public Key Hex String>
|
|
3209
3214
|
[partner_socket]: <Peer Connection Host:Port String>
|
|
3210
3215
|
}
|
|
3211
3216
|
|
|
@@ -3236,6 +3241,9 @@ minutes to fund the channels.
|
|
|
3236
3241
|
If you do not fund the channels, be sure to `cancelPendingChannel`s on each
|
|
3237
3242
|
channel that was not funded.
|
|
3238
3243
|
|
|
3244
|
+
Use `is_avoiding_broadcast` only when self-publishing the raw transaction
|
|
3245
|
+
after the funding step.
|
|
3246
|
+
|
|
3239
3247
|
{
|
|
3240
3248
|
channels: [{
|
|
3241
3249
|
capacity: <Channel Capacity Tokens Number>
|
|
@@ -3243,10 +3251,11 @@ channel that was not funded.
|
|
|
3243
3251
|
[give_tokens]: <Tokens to Gift To Partner Number> // Defaults to zero
|
|
3244
3252
|
[is_private]: <Channel is Private Bool> // Defaults to false
|
|
3245
3253
|
[min_htlc_mtokens]: <Minimum HTLC Millitokens String>
|
|
3246
|
-
partner_public_key: <Public Key Hex String>
|
|
3247
3254
|
[partner_csv_delay]: <Peer Output CSV Delay Number>
|
|
3255
|
+
partner_public_key: <Public Key Hex String>
|
|
3248
3256
|
[partner_socket]: <Peer Connection Host:Port String>
|
|
3249
3257
|
}]
|
|
3258
|
+
[is_avoiding_broadcast]: <Avoid Broadcast of All Channels Bool>
|
|
3250
3259
|
lnd: <Authenticated LND API Object>
|
|
3251
3260
|
}
|
|
3252
3261
|
|
|
@@ -6052,8 +6061,8 @@ This method is not supported in LND 0.13.4 and below
|
|
|
6052
6061
|
local_tokens: <Local Tokens Number>
|
|
6053
6062
|
[min_confirmations]: <Spend UTXOs With Minimum Confirmations Number>
|
|
6054
6063
|
[min_htlc_mtokens]: <Minimum HTLC Millitokens String>
|
|
6055
|
-
partner_public_key: <Public Key Hex String>
|
|
6056
6064
|
[partner_csv_delay]: <Peer Output CSV Delay Number>
|
|
6065
|
+
partner_public_key: <Public Key Hex String>
|
|
6057
6066
|
}
|
|
6058
6067
|
uri: <RPC URI String>
|
|
6059
6068
|
}
|
package/package.json
CHANGED
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
"cors": "2.8.5",
|
|
12
12
|
"express": "4.17.1",
|
|
13
13
|
"invoices": "2.0.2",
|
|
14
|
-
"lightning": "5.
|
|
14
|
+
"lightning": "5.2.1",
|
|
15
15
|
"macaroon": "3.0.4",
|
|
16
16
|
"morgan": "1.10.0",
|
|
17
|
-
"ws": "8.
|
|
17
|
+
"ws": "8.3.0"
|
|
18
18
|
},
|
|
19
19
|
"description": "Interaction helper for your Lightning Network daemon",
|
|
20
20
|
"devDependencies": {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"async": "3.2.2",
|
|
24
24
|
"asyncjs-util": "1.2.7",
|
|
25
25
|
"bip66": "1.1.5",
|
|
26
|
-
"bitcoinjs-lib": "6.0.
|
|
26
|
+
"bitcoinjs-lib": "6.0.1",
|
|
27
27
|
"bn.js": "5.2.0",
|
|
28
28
|
"ecpair": "1.0.1",
|
|
29
29
|
"ln-docker-daemons": "2.1.0",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"varuint-bitcoin": "1.1.2"
|
|
36
36
|
},
|
|
37
37
|
"engines": {
|
|
38
|
-
"node": ">=12"
|
|
38
|
+
"node": ">=12.20"
|
|
39
39
|
},
|
|
40
40
|
"keywords": [
|
|
41
41
|
"bitcoin",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"scripts": {
|
|
55
55
|
"test": "echo $DOCKER_LND_VERSION && tap -j 2 --branches=1 --functions=1 --lines=1 --statements=1 -t 200 test/autopilotrpc-integration/*.js test/chainrpc-integration/*.js test/integration/*.js test/invoicesrpc-integration/*.js test/routerrpc-integration/*.js test/signerrpc-integration/*.js test/tower_clientrpc-integration/*.js test/tower_serverrpc-integration/*.js test/walletrpc-integration/*.js"
|
|
56
56
|
},
|
|
57
|
-
"version": "53.0
|
|
57
|
+
"version": "53.2.0"
|
|
58
58
|
}
|
|
@@ -51,6 +51,7 @@ test(`Get pending channels`, async ({end, equal}) => {
|
|
|
51
51
|
equal(channel.pending_balance, 980950, 'Waiting on balance');
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
equal(channel.capacity, 1000000, 'Got channel capacity');
|
|
54
55
|
equal(channel.close_transaction_id, undefined, 'No close tx id');
|
|
55
56
|
equal(channel.is_active, false, 'Ended');
|
|
56
57
|
equal(channel.is_closing, true, 'Closing');
|
|
@@ -68,6 +68,7 @@ test(`Get pending channels`, async ({end, equal}) => {
|
|
|
68
68
|
equal(pendingOpen.transaction_weight, 724, 'Channel tx weight');
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
equal(pendingOpen.capacity, 1000000, 'Got channel opening capacity');
|
|
71
72
|
equal(pendingOpen.close_transaction_id, undefined, 'Not closing');
|
|
72
73
|
equal(pendingOpen.is_active, false, 'Not active yet');
|
|
73
74
|
equal(pendingOpen.is_closing, false, 'Not closing yet');
|
|
@@ -111,6 +112,7 @@ test(`Get pending channels`, async ({end, equal}) => {
|
|
|
111
112
|
equal(waitClose.pending_balance, 980950, 'Waiting on balance');
|
|
112
113
|
}
|
|
113
114
|
|
|
115
|
+
equal(waitClose.capacity, 1000000, 'Got channel closing capacity');
|
|
114
116
|
equal(waitClose.close_transaction_id, undefined, 'Waiting for close tx');
|
|
115
117
|
equal(waitClose.is_active, false, 'Not active yet');
|
|
116
118
|
equal(waitClose.is_closing, true, 'Channel is closing');
|
|
@@ -166,6 +168,7 @@ test(`Get pending channels`, async ({end, equal}) => {
|
|
|
166
168
|
equal(forceClose.pending_balance, 980950, 'Waiting on balance');
|
|
167
169
|
}
|
|
168
170
|
|
|
171
|
+
equal(forceClose.capacity, 1000000, 'Got channel close capacity');
|
|
169
172
|
equal(forceClose.close_transaction_id, channelClose.transaction_id, 'Txid');
|
|
170
173
|
equal(forceClose.is_active, false, 'Not active anymore');
|
|
171
174
|
equal(forceClose.is_closing, true, 'Channel is force closing');
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const asyncMap = require('async/map');
|
|
1
2
|
const asyncRetry = require('async/retry');
|
|
2
3
|
const {extractTransaction} = require('psbt');
|
|
3
4
|
const {finalizePsbt} = require('psbt');
|
|
@@ -6,22 +7,25 @@ const {test} = require('@alexbosworth/tap');
|
|
|
6
7
|
const {transactionAsPsbt} = require('psbt');
|
|
7
8
|
|
|
8
9
|
const {addPeer} = require('./../../');
|
|
10
|
+
const {createChainAddress} = require('./../../');
|
|
9
11
|
const {delay} = require('./../macros');
|
|
10
12
|
const {fundPendingChannels} = require('./../../');
|
|
11
13
|
const {getChainBalance} = require('./../../');
|
|
12
14
|
const {getChainTransactions} = require('./../../');
|
|
13
15
|
const {getChannels} = require('./../../');
|
|
16
|
+
const {getHeight} = require('./../../');
|
|
14
17
|
const {getPeers} = require('./../../');
|
|
15
18
|
const {openChannels} = require('./../../');
|
|
16
19
|
const {sendToChainAddresses} = require('./../../');
|
|
17
20
|
|
|
18
21
|
const capacity = 1e6;
|
|
19
22
|
const count = 10;
|
|
20
|
-
const interval =
|
|
23
|
+
const interval = 10;
|
|
24
|
+
const maturity = 100;
|
|
21
25
|
const race = promises => Promise.race(promises);
|
|
22
26
|
const size = 3;
|
|
23
27
|
const timeout = 250 * 10;
|
|
24
|
-
const times =
|
|
28
|
+
const times = 2000;
|
|
25
29
|
|
|
26
30
|
// Opening channels should open up channels
|
|
27
31
|
test(`Open channels`, async ({end, equal}) => {
|
|
@@ -29,11 +33,19 @@ test(`Open channels`, async ({end, equal}) => {
|
|
|
29
33
|
|
|
30
34
|
const [{generate, lnd}, target, remote] = nodes;
|
|
31
35
|
|
|
32
|
-
await
|
|
33
|
-
|
|
34
|
-
|
|
36
|
+
await generate({count: maturity});
|
|
37
|
+
|
|
38
|
+
await asyncRetry({interval, times}, async () => {
|
|
39
|
+
const lnds = [lnd, target.lnd, remote.lnd];
|
|
40
|
+
|
|
41
|
+
const heights = await asyncMap(lnds, async lnd => {
|
|
42
|
+
return (await getHeight({lnd})).current_block_height;
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const [controlHeight, targetHeight, remoteHeight] = heights;
|
|
35
46
|
|
|
36
|
-
|
|
47
|
+
if (controlHeight !== targetHeight || controlHeight !== remoteHeight) {
|
|
48
|
+
throw new Error('ExpectedSyncHeights');
|
|
37
49
|
}
|
|
38
50
|
});
|
|
39
51
|
|
|
@@ -42,11 +54,12 @@ test(`Open channels`, async ({end, equal}) => {
|
|
|
42
54
|
|
|
43
55
|
const spending = chainTx.map(({transaction}) => transaction);
|
|
44
56
|
|
|
45
|
-
await
|
|
57
|
+
const {address} = await createChainAddress({lnd});
|
|
46
58
|
|
|
47
|
-
const channels = [target, remote].map(
|
|
59
|
+
const channels = [target, remote].map(({id}) => ({
|
|
48
60
|
capacity,
|
|
49
|
-
|
|
61
|
+
cooperative_close_address: address,
|
|
62
|
+
partner_public_key: id,
|
|
50
63
|
}));
|
|
51
64
|
|
|
52
65
|
let pending;
|
|
@@ -54,6 +67,7 @@ test(`Open channels`, async ({end, equal}) => {
|
|
|
54
67
|
// Wait for peers to be connected
|
|
55
68
|
await asyncRetry({interval, times}, async () => {
|
|
56
69
|
await addPeer({lnd, public_key: remote.id, socket: remote.socket});
|
|
70
|
+
await addPeer({lnd, public_key: target.id, socket: target.socket});
|
|
57
71
|
|
|
58
72
|
if ((await getPeers({lnd})).peers.length !== channels.length) {
|
|
59
73
|
throw new Error('ExpectedConnectedPeersToOpenChannels');
|
|
@@ -67,13 +81,13 @@ test(`Open channels`, async ({end, equal}) => {
|
|
|
67
81
|
});
|
|
68
82
|
|
|
69
83
|
// Normally funding would involve an un-broadcast transaction
|
|
70
|
-
await sendToChainAddresses({lnd, send_to: pending});
|
|
84
|
+
const {id} = await sendToChainAddresses({lnd, send_to: pending});
|
|
71
85
|
|
|
72
|
-
await asyncRetry({interval, times}, async() => {
|
|
86
|
+
await asyncRetry({interval, times}, async () => {
|
|
73
87
|
const {transactions} = await getChainTransactions({lnd});
|
|
74
88
|
|
|
75
|
-
if (transactions.
|
|
76
|
-
throw new Error('
|
|
89
|
+
if (!transactions.find(n => n.id === id)) {
|
|
90
|
+
throw new Error('ExpectedChainTransaction');
|
|
77
91
|
}
|
|
78
92
|
|
|
79
93
|
return;
|
|
@@ -96,7 +110,7 @@ test(`Open channels`, async ({end, equal}) => {
|
|
|
96
110
|
});
|
|
97
111
|
|
|
98
112
|
await asyncRetry({interval, times}, async () => {
|
|
99
|
-
await generate({
|
|
113
|
+
await generate({});
|
|
100
114
|
|
|
101
115
|
const {channels} = await getChannels({lnd});
|
|
102
116
|
|
|
@@ -104,8 +118,14 @@ test(`Open channels`, async ({end, equal}) => {
|
|
|
104
118
|
throw new Error('ExpectedNewChannelsCreatedAndActive');
|
|
105
119
|
}
|
|
106
120
|
|
|
121
|
+
const [channel] = channels;
|
|
122
|
+
|
|
123
|
+
equal(channel.cooperative_close_address, address, 'Channel close addr');
|
|
124
|
+
|
|
107
125
|
return;
|
|
108
126
|
});
|
|
127
|
+
} catch (err) {
|
|
128
|
+
equal(err, null, 'No error is reported');
|
|
109
129
|
} finally {
|
|
110
130
|
return await kill({});
|
|
111
131
|
}
|
|
@@ -359,6 +359,7 @@ test(`Propose a channel with a coop delay`, async ({end, equal, ok}) => {
|
|
|
359
359
|
equal(incoming.transaction_weight, 724, 'Funding tx weight');
|
|
360
360
|
}
|
|
361
361
|
|
|
362
|
+
equal(incoming.capacity, 1000000, 'Incoming capacity is defined');
|
|
362
363
|
equal(incoming.close_transaction_id, undefined, 'Not a closing tx');
|
|
363
364
|
equal(incoming.is_active, false, 'Not active yet');
|
|
364
365
|
equal(incoming.is_closing, false, 'Channel is not closing');
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const {once} = require('events');
|
|
2
2
|
|
|
3
|
+
const asyncRetry = require('async/retry');
|
|
3
4
|
const {spawnLightningCluster} = require('ln-docker-daemons');
|
|
4
5
|
const {test} = require('@alexbosworth/tap');
|
|
5
6
|
|
|
@@ -9,7 +10,9 @@ const {removePeer} = require('./../../');
|
|
|
9
10
|
const {subscribeToPeers} = require('./../../');
|
|
10
11
|
|
|
11
12
|
const all = promise => Promise.all(promise);
|
|
13
|
+
const interval = 10;
|
|
12
14
|
const size = 2;
|
|
15
|
+
const times = 1000;
|
|
13
16
|
|
|
14
17
|
// Subscribing to peer events should trigger reception of peer status changes
|
|
15
18
|
test(`Subscribe to peers`, async ({end, equal}) => {
|
|
@@ -21,7 +24,9 @@ test(`Subscribe to peers`, async ({end, equal}) => {
|
|
|
21
24
|
|
|
22
25
|
sub.on('error', () => {});
|
|
23
26
|
|
|
24
|
-
await
|
|
27
|
+
await asyncRetry({interval, times}, async () => {
|
|
28
|
+
await addPeer({lnd, public_key: target.id, socket: target.socket});
|
|
29
|
+
});
|
|
25
30
|
|
|
26
31
|
const disconnect = removePeer({lnd, public_key: target.id});
|
|
27
32
|
const receiveDisconnect = once(sub, 'disconnected');
|
|
@@ -32,7 +37,9 @@ test(`Subscribe to peers`, async ({end, equal}) => {
|
|
|
32
37
|
|
|
33
38
|
equal(disconnected.public_key, target.id, 'Got d/c event');
|
|
34
39
|
|
|
35
|
-
const connect =
|
|
40
|
+
const connect = asyncRetry({interval, times}, async () => {
|
|
41
|
+
return addPeer({lnd, public_key: target.id, socket: target.socket});
|
|
42
|
+
});
|
|
36
43
|
|
|
37
44
|
const receiveConnectMessage = once(sub, 'connected');
|
|
38
45
|
|
|
@@ -103,7 +103,7 @@ test(`Pay with multiple paths`, async ({end, equal, rejects, strictSame}) => {
|
|
|
103
103
|
total_mtokens: parsed.mtokens,
|
|
104
104
|
});
|
|
105
105
|
|
|
106
|
-
// Pay using routes. Multiple channels must be used
|
|
106
|
+
// Pay using routes. Multiple channels must be used to avoid tempChanFail
|
|
107
107
|
try {
|
|
108
108
|
const routes = [route1.route, route2.route];
|
|
109
109
|
|