ln-service 53.13.0 → 53.14.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
CHANGED
package/README.md
CHANGED
|
@@ -102,6 +102,7 @@ for `unlocker` methods.
|
|
|
102
102
|
|
|
103
103
|
## All Methods
|
|
104
104
|
|
|
105
|
+
- [addExternalSocket](#addexternalsocket) - Advertise a new p2p host:ip address
|
|
105
106
|
- [addPeer](#addpeer) - Connect to a peer
|
|
106
107
|
- [authenticatedLndGrpc](#authenticatedlndgrpc) - LND API Object
|
|
107
108
|
- [broadcastChainTransaction](#broadcastchaintransaction) - Push a chain tx
|
|
@@ -201,6 +202,7 @@ for `unlocker` methods.
|
|
|
201
202
|
- [proposeChannel](#proposechannel) - Offer a channel proposal to a peer
|
|
202
203
|
- [recoverFundsFromChannel](#recoverfundsfromchannel) - Restore a channel
|
|
203
204
|
- [recoverFundsFromChannels](#recoverfundsfromchannels) - Restore all channels
|
|
205
|
+
- [removeExternalSocket](#removeexternalsocket) - Remove a p2p host:ip announce
|
|
204
206
|
- [removePeer](#removepeer) - Disconnect from a connected peer
|
|
205
207
|
- [requestChainFeeIncrease](#requestchainfeeincrease) - Request a CPFP spend on
|
|
206
208
|
a UTXO
|
|
@@ -281,6 +283,32 @@ for `unlocker` methods.
|
|
|
281
283
|
- [probing](https://npmjs.com/package/probing) - payment probing utilities
|
|
282
284
|
- [psbt](https://www.npmjs.com/package/psbt) - BIP 174 PSBT utilities
|
|
283
285
|
|
|
286
|
+
### addExternalSocket
|
|
287
|
+
|
|
288
|
+
Add a new advertised p2p socket address
|
|
289
|
+
|
|
290
|
+
Note: this method is not supported in LND versions 0.14.3 and below
|
|
291
|
+
|
|
292
|
+
Requires LND built with `peersrpc` build tag
|
|
293
|
+
|
|
294
|
+
Requires `peers:write` permissions
|
|
295
|
+
|
|
296
|
+
{
|
|
297
|
+
lnd: <Authenticated LND API Object>
|
|
298
|
+
socket: <Add Socket Address String>
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
@returns via cbk or Promise
|
|
302
|
+
|
|
303
|
+
Example:
|
|
304
|
+
|
|
305
|
+
```node
|
|
306
|
+
const {addExternalSocket} = require('ln-service');
|
|
307
|
+
|
|
308
|
+
// Add a new address to advertise on the graph via gossip
|
|
309
|
+
await addExternalSocket({lnd, socket: '192.168.0.1:9735'});
|
|
310
|
+
```
|
|
311
|
+
|
|
284
312
|
### addPeer
|
|
285
313
|
|
|
286
314
|
Add a peer if possible (not self, or already connected)
|
|
@@ -4139,6 +4167,32 @@ const {backup} = await getBackups({lnd});
|
|
|
4139
4167
|
await recoverFundsFromChannels({backup, lnd});
|
|
4140
4168
|
```
|
|
4141
4169
|
|
|
4170
|
+
### removeExternalSocket
|
|
4171
|
+
|
|
4172
|
+
Remove an existing advertised p2p socket address
|
|
4173
|
+
|
|
4174
|
+
Note: this method is not supported in LND versions 0.14.3 and below
|
|
4175
|
+
|
|
4176
|
+
Requires LND built with `peersrpc` build tag
|
|
4177
|
+
|
|
4178
|
+
Requires `peers:write` permissions
|
|
4179
|
+
|
|
4180
|
+
{
|
|
4181
|
+
lnd: <Authenticated LND API Object>
|
|
4182
|
+
socket: <Remove Socket Address String>
|
|
4183
|
+
}
|
|
4184
|
+
|
|
4185
|
+
@returns via cbk or Promise
|
|
4186
|
+
|
|
4187
|
+
Example:
|
|
4188
|
+
|
|
4189
|
+
```node
|
|
4190
|
+
const {removeExternalSocket} = require('ln-service');
|
|
4191
|
+
|
|
4192
|
+
// Stop an address being advertised on the graph via gossip
|
|
4193
|
+
await removeExternalSocket({lnd, socket: '127.0.0.1:9735'});
|
|
4194
|
+
```
|
|
4195
|
+
|
|
4142
4196
|
### removePeer
|
|
4143
4197
|
|
|
4144
4198
|
Remove a peer if possible
|
package/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const {addExternalSocket} = require('lightning');
|
|
1
2
|
const {addPeer} = require('lightning');
|
|
2
3
|
const {authenticatedLndGrpc} = require('lightning');
|
|
3
4
|
const {broadcastChainTransaction} = require('lightning');
|
|
@@ -88,6 +89,7 @@ const {probeForRoute} = require('lightning');
|
|
|
88
89
|
const {proposeChannel} = require('lightning');
|
|
89
90
|
const {recoverFundsFromChannel} = require('lightning');
|
|
90
91
|
const {recoverFundsFromChannels} = require('lightning');
|
|
92
|
+
const {removeExternalSocket} = require('lightning');
|
|
91
93
|
const {removePeer} = require('lightning');
|
|
92
94
|
const {requestChainFeeIncrease} = require('lightning');
|
|
93
95
|
const {restrictMacaroon} = require('./macaroons');
|
|
@@ -142,6 +144,7 @@ const {verifyBytesSignature} = require('lightning');
|
|
|
142
144
|
const {verifyMessage} = require('lightning');
|
|
143
145
|
|
|
144
146
|
module.exports = {
|
|
147
|
+
addExternalSocket,
|
|
145
148
|
addPeer,
|
|
146
149
|
authenticatedLndGrpc,
|
|
147
150
|
broadcastChainTransaction,
|
|
@@ -232,6 +235,7 @@ module.exports = {
|
|
|
232
235
|
proposeChannel,
|
|
233
236
|
recoverFundsFromChannel,
|
|
234
237
|
recoverFundsFromChannels,
|
|
238
|
+
removeExternalSocket,
|
|
235
239
|
removePeer,
|
|
236
240
|
requestChainFeeIncrease,
|
|
237
241
|
restrictMacaroon,
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"cors": "2.8.5",
|
|
12
12
|
"express": "4.17.3",
|
|
13
13
|
"invoices": "2.0.6",
|
|
14
|
-
"lightning": "5.
|
|
14
|
+
"lightning": "5.13.0",
|
|
15
15
|
"macaroon": "3.0.4",
|
|
16
16
|
"morgan": "1.10.0",
|
|
17
17
|
"ws": "8.5.0"
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"bn.js": "5.2.0",
|
|
29
29
|
"bs58check": "2.1.2",
|
|
30
30
|
"ecpair": "2.0.1",
|
|
31
|
-
"ln-docker-daemons": "2.2.
|
|
31
|
+
"ln-docker-daemons": "2.2.9",
|
|
32
32
|
"p2tr": "1.3.1",
|
|
33
33
|
"portfinder": "1.0.28",
|
|
34
34
|
"psbt": "2.0.1",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"integration-test-0.12.0": "DOCKER_LND_VERSION=v0.12.0-beta npm run test",
|
|
71
71
|
"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"
|
|
72
72
|
},
|
|
73
|
-
"version": "53.
|
|
73
|
+
"version": "53.14.0"
|
|
74
74
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const {spawnLightningCluster} = require('ln-docker-daemons');
|
|
2
|
+
const {test} = require('@alexbosworth/tap');
|
|
3
|
+
|
|
4
|
+
const {addExternalSocket} = require('./../../');
|
|
5
|
+
const {getWalletInfo} = require('./../../');
|
|
6
|
+
|
|
7
|
+
const socket = '192.168.0.1:12345';
|
|
8
|
+
|
|
9
|
+
// Adding a node socket should result in an updated advertised socket
|
|
10
|
+
test(`Add external socket`, async ({end, strictSame}) => {
|
|
11
|
+
const {kill, nodes} = await spawnLightningCluster({});
|
|
12
|
+
|
|
13
|
+
const [{id, lnd}] = nodes;
|
|
14
|
+
|
|
15
|
+
const additional = `${id}@${socket}`;
|
|
16
|
+
|
|
17
|
+
try {
|
|
18
|
+
const {uris} = await getWalletInfo({lnd});
|
|
19
|
+
|
|
20
|
+
const [existing] = uris;
|
|
21
|
+
|
|
22
|
+
await addExternalSocket({lnd, socket});
|
|
23
|
+
|
|
24
|
+
const updated = await getWalletInfo({lnd});
|
|
25
|
+
|
|
26
|
+
strictSame(updated.uris, [existing, additional], 'Added new socket');
|
|
27
|
+
} catch (err) {
|
|
28
|
+
strictSame(err, [400, 'ExpectedPeersRpcLndBuildTagToAddSocket']);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
await kill({});
|
|
32
|
+
|
|
33
|
+
return end();
|
|
34
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const {spawnLightningCluster} = require('ln-docker-daemons');
|
|
2
|
+
const {test} = require('@alexbosworth/tap');
|
|
3
|
+
|
|
4
|
+
const {getWalletInfo} = require('./../../');
|
|
5
|
+
const {removeExternalSocket} = require('./../../');
|
|
6
|
+
|
|
7
|
+
// Removign a node socket should result in a no longer advertised socket
|
|
8
|
+
test(`Add external socket`, async ({end, strictSame}) => {
|
|
9
|
+
const {kill, nodes} = await spawnLightningCluster({});
|
|
10
|
+
|
|
11
|
+
const [{id, lnd}] = nodes;
|
|
12
|
+
|
|
13
|
+
try {
|
|
14
|
+
const {uris} = await getWalletInfo({lnd});
|
|
15
|
+
|
|
16
|
+
const [uri] = uris;
|
|
17
|
+
|
|
18
|
+
const [, socket] = uri.split('@');
|
|
19
|
+
|
|
20
|
+
await removeExternalSocket({lnd, socket});
|
|
21
|
+
|
|
22
|
+
const updated = await getWalletInfo({lnd});
|
|
23
|
+
|
|
24
|
+
strictSame(updated.uris, [], 'External socket removed');
|
|
25
|
+
} catch (err) {
|
|
26
|
+
strictSame(err, [400, 'ExpectedPeersRpcLndBuildTagToRemoveSocket']);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
await kill({});
|
|
30
|
+
|
|
31
|
+
return end();
|
|
32
|
+
});
|