ln-service 56.9.0 → 56.10.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
|
@@ -641,6 +641,13 @@ Requires `address:write`, `invoices:write` permission
|
|
|
641
641
|
[is_including_private_channels]: <Invoice Includes Private Channels Bool>
|
|
642
642
|
lnd: <Authenticated LND API Object>
|
|
643
643
|
[mtokens]: <Millitokens String>
|
|
644
|
+
[routes]: [[{
|
|
645
|
+
[base_fee_mtokens]: <Base Routing Fee In Millitokens String>
|
|
646
|
+
[channel]: <Standard Format Channel Id String>
|
|
647
|
+
[cltv_delta]: <CLTV Blocks Delta Number>
|
|
648
|
+
[fee_rate]: <Fee Rate In Millitokens Per Million Number>
|
|
649
|
+
public_key: <Forward Edge Public Key Hex String>
|
|
650
|
+
}]]
|
|
644
651
|
[tokens]: <Tokens Number>
|
|
645
652
|
}
|
|
646
653
|
|
|
@@ -707,6 +714,13 @@ Requires `address:write`, `invoices:write` permission
|
|
|
707
714
|
lnd: <Authenticated LND API Object>
|
|
708
715
|
[secret]: <Payment Preimage Hex String>
|
|
709
716
|
[mtokens]: <Millitokens String>
|
|
717
|
+
[routes]: [[{
|
|
718
|
+
[base_fee_mtokens]: <Base Routing Fee In Millitokens String>
|
|
719
|
+
[channel]: <Standard Format Channel Id String>
|
|
720
|
+
[cltv_delta]: <CLTV Blocks Delta Number>
|
|
721
|
+
[fee_rate]: <Fee Rate In Millitokens Per Million Number>
|
|
722
|
+
public_key: <Forward Edge Public Key Hex String>
|
|
723
|
+
}]]
|
|
710
724
|
[tokens]: <Tokens Number>
|
|
711
725
|
}
|
|
712
726
|
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"cors": "2.8.5",
|
|
12
12
|
"express": "4.18.2",
|
|
13
13
|
"invoices": "3.0.0",
|
|
14
|
-
"lightning": "9.
|
|
14
|
+
"lightning": "9.10.0",
|
|
15
15
|
"macaroon": "3.0.4",
|
|
16
16
|
"morgan": "1.10.0",
|
|
17
17
|
"ws": "8.13.0"
|
|
@@ -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": "56.
|
|
72
|
+
"version": "56.10.0"
|
|
73
73
|
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
const {deepEqual} = require('node:assert').strict;
|
|
2
|
+
const test = require('node:test');
|
|
3
|
+
|
|
4
|
+
const asyncRetry = require('async/retry');
|
|
5
|
+
const {setupChannel} = require('ln-docker-daemons');
|
|
6
|
+
const {spawnLightningCluster} = require('ln-docker-daemons');
|
|
7
|
+
|
|
8
|
+
const {cancelHodlInvoice} = require('./../../');
|
|
9
|
+
const {createHodlInvoice} = require('./../../');
|
|
10
|
+
const {createInvoice} = require('./../../');
|
|
11
|
+
const {parsePaymentRequest} = require('./../../');
|
|
12
|
+
|
|
13
|
+
const interval = 10;
|
|
14
|
+
const size = 3;
|
|
15
|
+
const times = 1000;
|
|
16
|
+
const tokens = 100;
|
|
17
|
+
|
|
18
|
+
// createInvoice should result in a created invoice with hop hints
|
|
19
|
+
test(`Create an invoice with hop hints`, async t => {
|
|
20
|
+
const {kill, nodes} = await spawnLightningCluster({size});
|
|
21
|
+
|
|
22
|
+
t.after(async () => await kill({}));
|
|
23
|
+
|
|
24
|
+
const [{generate, lnd}, target, remote] = nodes;
|
|
25
|
+
|
|
26
|
+
const channel = await setupChannel({generate, lnd, to: target});
|
|
27
|
+
|
|
28
|
+
const remoteChannel = await setupChannel({
|
|
29
|
+
generate: target.generate,
|
|
30
|
+
is_private: true,
|
|
31
|
+
lnd: target.lnd,
|
|
32
|
+
to: remote,
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const specialRoutes = [[
|
|
36
|
+
{
|
|
37
|
+
public_key: target.id,
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
base_fee_mtokens: '123456',
|
|
41
|
+
channel: remoteChannel.id,
|
|
42
|
+
cltv_delta: 200,
|
|
43
|
+
fee_rate: 123456,
|
|
44
|
+
public_key: remote.id,
|
|
45
|
+
},
|
|
46
|
+
]];
|
|
47
|
+
|
|
48
|
+
const invoice = await asyncRetry({interval, times}, async () => {
|
|
49
|
+
const invoice = await createInvoice({
|
|
50
|
+
tokens,
|
|
51
|
+
is_including_private_channels: true,
|
|
52
|
+
lnd: remote.lnd,
|
|
53
|
+
routes: specialRoutes,
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const hodlInvoice = await createHodlInvoice({
|
|
57
|
+
tokens,
|
|
58
|
+
is_including_private_channels: true,
|
|
59
|
+
lnd: remote.lnd,
|
|
60
|
+
routes: specialRoutes,
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const {routes} = parsePaymentRequest({request: invoice.request});
|
|
64
|
+
|
|
65
|
+
// Wait for private routes to get picked up
|
|
66
|
+
if (!routes) {
|
|
67
|
+
await cancelHodlInvoice({id: invoice.id, lnd: remote.lnd});
|
|
68
|
+
|
|
69
|
+
throw new Error('ExpectedRouteForInvoice');
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const hodl = parsePaymentRequest({request: hodlInvoice.request});
|
|
73
|
+
|
|
74
|
+
// Wait for private routes to get picked up
|
|
75
|
+
if (!hodl.routes) {
|
|
76
|
+
await cancelHodlInvoice({id: hodl.id, lnd: remote.lnd});
|
|
77
|
+
|
|
78
|
+
throw new Error('ExpectedRouteForHodlInvoice');
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return {
|
|
82
|
+
normal_routes: routes,
|
|
83
|
+
hodl_routes: hodl.routes,
|
|
84
|
+
};
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
deepEqual(invoice.normal_routes, specialRoutes, 'Got expected routes');
|
|
88
|
+
deepEqual(invoice.hodl_routes, specialRoutes, 'Got expected hodl routes');
|
|
89
|
+
|
|
90
|
+
return;
|
|
91
|
+
});
|