ln-service 54.6.0 → 54.8.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
@@ -1,5 +1,13 @@
1
1
  # Versions
2
2
 
3
+ ## 54.8.0
4
+
5
+ - `subscribeToRpcRequests`: add `max_tokens_per_vbyte` to RPC close requests
6
+
7
+ ## 54.7.0
8
+
9
+ - `getBlock`: add `height` to allow fetching a raw block at a specified height
10
+
3
11
  ## 54.6.0
4
12
 
5
13
  - `getBlock`: Add method to retrieve the raw bytes of a block in the chain
package/README.md CHANGED
@@ -1420,7 +1420,8 @@ Requires `onchain:read` permission
1420
1420
  This method is not supported on LND 0.15.5 and below
1421
1421
 
1422
1422
  {
1423
- id: <Block Hash Hex String>
1423
+ [height]: <Block Height Number>
1424
+ [id]: <Block Hash Hex String>
1424
1425
  lnd: <Authenticated LND API Object>
1425
1426
  }
1426
1427
 
@@ -6741,6 +6742,7 @@ This method is not supported in LND 0.13.4 and below
6741
6742
  request: {
6742
6743
  [address]: <Request Sending Local Channel Funds To Address String>
6743
6744
  [is_force_close]: <Is Force Close Bool>
6745
+ [max_tokens_per_vbyte]: <Max Tokens Per VByte Number>
6744
6746
  [target_confirmations]: <Confirmation Target Number>
6745
6747
  [tokens_per_vbyte]: <Tokens Per Virtual Byte Number>
6746
6748
  transaction_id: <Transaction Id Hex String>
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "cors": "2.8.5",
12
12
  "express": "4.18.2",
13
13
  "invoices": "2.2.2",
14
- "lightning": "6.6.0",
14
+ "lightning": "6.8.0",
15
15
  "macaroon": "3.0.4",
16
16
  "morgan": "1.10.0",
17
17
  "ws": "8.11.0"
@@ -64,5 +64,5 @@
64
64
  "integration-test-0.14.4": "DOCKER_LND_VERSION=v0.14.4-beta npm run test",
65
65
  "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"
66
66
  },
67
- "version": "54.6.0"
67
+ "version": "54.8.0"
68
68
  }
@@ -18,15 +18,41 @@ test(`Get height`, async ({end, equal, fail}) => {
18
18
 
19
19
  const blockchain = await getHeight({lnd});
20
20
 
21
+ const hash = blockchain.current_block_hash;
22
+ const height = blockchain.current_block_height;
23
+
24
+ // Try getting a block by the hash
21
25
  try {
22
26
  const {block} = await getBlock({lnd, id: blockchain.current_block_hash});
23
27
 
24
- equal(fromHex(block).getId(), blockchain.current_block_hash, 'Got block');
28
+ equal(fromHex(block).getId(), hash, 'Got block');
25
29
  } catch (err) {
26
30
  const [code, message] = err;
27
31
 
28
32
  equal(code, 501, 'Got expected code');
29
33
  equal(message, 'GetBlockMethodNotSupported', 'Got expected message');
34
+
35
+ await kill({});
36
+
37
+ return end();
38
+ }
39
+
40
+ // Try getting a block by the height
41
+ try {
42
+ const {block} = await getBlock({height, lnd});
43
+
44
+ equal(fromHex(block).getId(), hash, 'Got block for height');
45
+ } catch (err) {
46
+ equal(err, null, 'Expected no error');
47
+ }
48
+
49
+ // Try getting the chain tip block
50
+ try {
51
+ const {block} = await getBlock({lnd});
52
+
53
+ equal(fromHex(block).getId(), hash, 'Got chain tip block');
54
+ } catch (err) {
55
+ equal(err, null, 'Expected no error');
30
56
  }
31
57
 
32
58
  await kill({});
@@ -179,6 +179,8 @@ test(`Subscribe to RPC requests`, async ({end, equal, fail, strictSame}) => {
179
179
  subscription.on('close_channel_request', async intercepted => {
180
180
  // Stop all open channel requests that close out to an address
181
181
  if (!!intercepted.request.address) {
182
+ strictSame(intercepted.request.max_tokens_per_vbyte, 10, 'Max fee');
183
+
182
184
  await intercepted.reject({message: 'message'});
183
185
  } else {
184
186
  await intercepted.accept({});
@@ -191,6 +193,7 @@ test(`Subscribe to RPC requests`, async ({end, equal, fail, strictSame}) => {
191
193
  await closeChannel({
192
194
  lnd,
193
195
  address: 'address',
196
+ max_tokens_per_vbyte: 10,
194
197
  transaction_id: Buffer.alloc(32).toString('hex'),
195
198
  transaction_vout: 0,
196
199
  });
@@ -122,26 +122,30 @@ test(`Pay with multiple paths`, async ({end, equal, rejects, strictSame}) => {
122
122
 
123
123
  const parsed = parsePaymentRequest({request: controlInvoice.request});
124
124
 
125
- const route1 = await getRouteToDestination({
126
- cltv_delta: parsed.cltv_delta,
127
- destination: parsed.destination,
128
- features: parsed.features,
129
- lnd: target.lnd,
130
- outgoing_channel: channel1.id,
131
- payment: parsed.payment,
132
- tokens: ceil(parsed.tokens / channels.length),
133
- total_mtokens: parsed.mtokens,
125
+ const route1 = await asyncRetry({interval, times}, async () => {
126
+ return await getRouteToDestination({
127
+ cltv_delta: parsed.cltv_delta,
128
+ destination: parsed.destination,
129
+ features: parsed.features,
130
+ lnd: target.lnd,
131
+ outgoing_channel: channel1.id,
132
+ payment: parsed.payment,
133
+ tokens: ceil(parsed.tokens / channels.length),
134
+ total_mtokens: parsed.mtokens,
135
+ });
134
136
  });
135
137
 
136
- const route2 = await getRouteToDestination({
137
- cltv_delta: parsed.cltv_delta,
138
- destination: parsed.destination,
139
- features: parsed.features,
140
- lnd: target.lnd,
141
- outgoing_channel: channel2.id,
142
- payment: parsed.payment,
143
- tokens: ceil(parsed.tokens / channels.length),
144
- total_mtokens: parsed.mtokens,
138
+ const route2 = await asyncRetry({interval, times}, async () => {
139
+ return await getRouteToDestination({
140
+ cltv_delta: parsed.cltv_delta,
141
+ destination: parsed.destination,
142
+ features: parsed.features,
143
+ lnd: target.lnd,
144
+ outgoing_channel: channel2.id,
145
+ payment: parsed.payment,
146
+ tokens: ceil(parsed.tokens / channels.length),
147
+ total_mtokens: parsed.mtokens,
148
+ });
145
149
  });
146
150
 
147
151
  // Pay using routes. Multiple channels must be used to avoid tempChanFail
@@ -149,10 +153,12 @@ test(`Pay with multiple paths`, async ({end, equal, rejects, strictSame}) => {
149
153
  const routes = [route1.route, route2.route];
150
154
 
151
155
  const payRoutes = routes.map(route => {
152
- return payViaRoutes({
153
- id: parsed.id,
154
- lnd: target.lnd,
155
- routes: [route],
156
+ return asyncRetry({interval, times}, async () => {
157
+ return payViaRoutes({
158
+ id: parsed.id,
159
+ lnd: target.lnd,
160
+ routes: [route],
161
+ });
156
162
  });
157
163
  });
158
164