ln-service 57.7.1 → 57.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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # Versions
2
2
 
3
+ ## 57.8.1
4
+
5
+ - `pay` and payment via request methods: disallow features 30/31 from payments
6
+
7
+ ## 57.8.0
8
+
9
+ - `removeAdvertisedFeature`: Add method to remove a feature bit support ad
10
+
3
11
  ## 57.7.1
4
12
 
5
13
  - `getPendingChannels`: Add support for `close_transaction` to return raw tx
package/README.md CHANGED
@@ -245,6 +245,7 @@ for `unlocker` methods.
245
245
  - [proposeChannel](#proposechannel) - Offer a channel proposal to a peer
246
246
  - [recoverFundsFromChannel](#recoverfundsfromchannel) - Restore a channel
247
247
  - [recoverFundsFromChannels](#recoverfundsfromchannels) - Restore all channels
248
+ - [removeAdvertisedFeature](#removeadvertisedfeature) - Remove feature from ad
248
249
  - [removeExternalSocket](#removeexternalsocket) - Remove a p2p host:ip announce
249
250
  - [removePeer](#removepeer) - Disconnect from a connected peer
250
251
  - [requestChainFeeIncrease](#requestchainfeeincrease) - Request a CPFP spend on
@@ -4682,6 +4683,32 @@ const {backup} = await getBackups({lnd});
4682
4683
  await recoverFundsFromChannels({backup, lnd});
4683
4684
  ```
4684
4685
 
4686
+ ### removeAdvertisedFeature
4687
+
4688
+ Remove an advertised feature from the graph node announcement
4689
+
4690
+ Note: this method is not supported in LND versions 0.14.5 and below
4691
+
4692
+ Requires LND built with `peersrpc` build tag
4693
+
4694
+ Requires `peers:write` permissions
4695
+
4696
+ {
4697
+ feature: <BOLT 09 Feature Bit Number>
4698
+ lnd: <Authenticated LND API Object>
4699
+ }
4700
+
4701
+ @returns via cbk or Promise
4702
+
4703
+ Example:
4704
+
4705
+ ```node
4706
+ const {removeAdvertisedFeature} = require('ln-service');
4707
+
4708
+ // Remove a supported feature from the graph node announcement
4709
+ await removeAdvertisedFeature({lnd, feature: 12345});
4710
+ ```
4711
+
4685
4712
  ### removeExternalSocket
4686
4713
 
4687
4714
  Remove an existing advertised p2p socket address
package/index.js CHANGED
@@ -100,6 +100,7 @@ const {probeForRoute} = require('lightning');
100
100
  const {proposeChannel} = require('lightning');
101
101
  const {recoverFundsFromChannel} = require('lightning');
102
102
  const {recoverFundsFromChannels} = require('lightning');
103
+ const {removeAdvertisedFeature} = require('lightning');
103
104
  const {removeExternalSocket} = require('lightning');
104
105
  const {removePeer} = require('lightning');
105
106
  const {requestChainFeeIncrease} = require('lightning');
@@ -261,6 +262,7 @@ module.exports = {
261
262
  proposeChannel,
262
263
  recoverFundsFromChannel,
263
264
  recoverFundsFromChannels,
265
+ removeAdvertisedFeature,
264
266
  removeExternalSocket,
265
267
  removePeer,
266
268
  requestChainFeeIncrease,
package/package.json CHANGED
@@ -9,12 +9,12 @@
9
9
  "dependencies": {
10
10
  "bolt07": "1.8.4",
11
11
  "invoices": "3.0.0",
12
- "lightning": "10.7.1",
12
+ "lightning": "10.8.2",
13
13
  "macaroon": "3.0.4"
14
14
  },
15
15
  "description": "Interaction helper for your Lightning Network daemon",
16
16
  "devDependencies": {
17
- "@alexbosworth/blockchain": "1.7.0",
17
+ "@alexbosworth/blockchain": "2.0.0",
18
18
  "@alexbosworth/node-fetch": "2.6.2",
19
19
  "async": "3.2.5",
20
20
  "asyncjs-util": "1.2.12",
@@ -69,5 +69,5 @@
69
69
  "integration-test-0.14.4": "DOCKER_LND_VERSION=v0.14.4-beta npm run test",
70
70
  "test": "echo $DOCKER_LND_VERSION && node test/runner"
71
71
  },
72
- "version": "57.7.1"
72
+ "version": "57.8.1"
73
73
  }
@@ -84,7 +84,11 @@ test('Payment errors', async () => {
84
84
  route.tokens = 1000;
85
85
 
86
86
  await pay({lnd, path: {id, routes: [route]}});
87
+
88
+ await kill({});
87
89
  } catch (err) {
90
+ await kill({});
91
+
88
92
  if (Array.isArray(err)) {
89
93
  const [, code, context] = err;
90
94
 
@@ -94,7 +98,5 @@ test('Payment errors', async () => {
94
98
  }
95
99
  }
96
100
 
97
- await kill({});
98
-
99
101
  return;
100
102
  });
@@ -67,11 +67,13 @@ test(`Cancel back a hodl invoice`, async () => {
67
67
 
68
68
  equal(code, 503, 'Canceled back HODL HTLC results in 404');
69
69
  equal(message, 'PaymentRejectedByDestination', 'Got back 404 error');
70
+
71
+ await kill({});
70
72
  } catch (err) {
73
+ await kill({});
74
+
71
75
  equal(err, null, 'Expected no error');
72
76
  }
73
77
 
74
- await kill({});
75
-
76
78
  return;
77
79
  });
@@ -0,0 +1,37 @@
1
+ const {equal} = require('node:assert').strict;
2
+ const test = require('node:test');
3
+
4
+ const {spawnLightningCluster} = require('ln-docker-daemons');
5
+
6
+ const {addAdvertisedFeature} = require('./../../');
7
+ const {getWalletInfo} = require('./../../');
8
+ const {removeAdvertisedFeature} = require('./../../');
9
+
10
+ const feature = 12345;
11
+
12
+ // Removing a feature should result in an updated advertised feature
13
+ test(`Add external socket`, async () => {
14
+ const {kill, nodes} = await spawnLightningCluster({});
15
+
16
+ const [{id, lnd}] = nodes;
17
+
18
+ try {
19
+ await addAdvertisedFeature({feature, lnd});
20
+
21
+ await removeAdvertisedFeature({feature, lnd});
22
+
23
+ const {features} = await getWalletInfo({lnd});
24
+
25
+ const added = features.find(n => n.bit === feature);
26
+
27
+ equal(added, undefined, 'Feature was removed');
28
+
29
+ await kill({});
30
+ } catch (err) {
31
+ await kill({});
32
+
33
+ deepEqual(err, [400, 'ExpectedPeersRpcLndBuildTagToAddFeature']);
34
+ }
35
+
36
+ return;
37
+ });
@@ -89,11 +89,13 @@ test('Delete forwarding reputations', async () => {
89
89
 
90
90
  equal(nodes.length, [].length, 'Reputations should be wiped');
91
91
  }
92
+
93
+ await kill({});
92
94
  } catch (err) {
95
+ await kill({});
96
+
93
97
  equal(err, null, 'Expected no error');
94
98
  }
95
99
 
96
- await kill({});
97
-
98
100
  return;
99
101
  });