ln-service 56.8.2 → 56.9.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 +4 -0
- package/README.md +1 -0
- package/package.json +2 -2
- package/test/integration/test_trusted_open.js +94 -0
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -3724,6 +3724,7 @@ Requires `offchain:write`, `onchain:write`, `peers:write` permissions
|
|
|
3724
3724
|
[give_tokens]: <Tokens to Gift To Partner Number> // Defaults to zero
|
|
3725
3725
|
[is_max_funding]: <Use Maximal Chain Funds For Local Funding Bool>
|
|
3726
3726
|
[is_private]: <Channel is Private Bool> // Defaults to false
|
|
3727
|
+
[is_trusted_funding]: <Accept Funding as Trusted Bool>
|
|
3727
3728
|
lnd: <Authenticated LND API Object>
|
|
3728
3729
|
local_tokens: <Total Channel Capacity Tokens Number>
|
|
3729
3730
|
[min_confirmations]: <Spend UTXOs With Minimum Confirmations Number>
|
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.9.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.9.0"
|
|
73
73
|
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
const {deepEqual} = require('node:assert').strict;
|
|
2
|
+
const {equal} = require('node:assert').strict;
|
|
3
|
+
const test = require('node:test');
|
|
4
|
+
|
|
5
|
+
const asyncRetry = require('async/retry');
|
|
6
|
+
const {spawnLightningCluster} = require('ln-docker-daemons');
|
|
7
|
+
|
|
8
|
+
const {addPeer} = require('./../../');
|
|
9
|
+
const {getEphemeralChannelIds} = require('./../../');
|
|
10
|
+
const {openChannel} = require('./../../');
|
|
11
|
+
const {openChannels} = require('./../../');
|
|
12
|
+
const {subscribeToChannels} = require('./../../');
|
|
13
|
+
const {subscribeToOpenRequests} = require('./../../');
|
|
14
|
+
|
|
15
|
+
const capacity = 1e6;
|
|
16
|
+
const interval = 10;
|
|
17
|
+
const maturity = 100;
|
|
18
|
+
const size = 2;
|
|
19
|
+
const times = 4000;
|
|
20
|
+
|
|
21
|
+
// Opening an unconfirmed channel should in an immediate channel opening
|
|
22
|
+
test(`Open an unconfirmed channel`, async () => {
|
|
23
|
+
// Unconfirmed channels are not supported on LND 0.15.0 and below
|
|
24
|
+
{
|
|
25
|
+
const {kill, nodes} = await spawnLightningCluster({});
|
|
26
|
+
|
|
27
|
+
const [{lnd}] = nodes;
|
|
28
|
+
|
|
29
|
+
try {
|
|
30
|
+
await getEphemeralChannelIds({lnd});
|
|
31
|
+
|
|
32
|
+
await kill({});
|
|
33
|
+
} catch (err) {
|
|
34
|
+
deepEqual(err, [501, 'ListAliasesMethodNotSupported']);
|
|
35
|
+
|
|
36
|
+
await kill({});
|
|
37
|
+
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const {kill, nodes} = await spawnLightningCluster({
|
|
43
|
+
size,
|
|
44
|
+
lnd_configuration: [
|
|
45
|
+
'--maxpendingchannels=10',
|
|
46
|
+
'--protocol.option-scid-alias',
|
|
47
|
+
'--protocol.zero-conf',
|
|
48
|
+
],
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const [{generate, lnd}, target] = nodes;
|
|
52
|
+
|
|
53
|
+
try {
|
|
54
|
+
await generate({count: maturity});
|
|
55
|
+
|
|
56
|
+
// Connect to the peer
|
|
57
|
+
await addPeer({lnd, public_key: target.id, socket: target.socket});
|
|
58
|
+
|
|
59
|
+
// Wait for channel to be receptive to opens
|
|
60
|
+
await asyncRetry({interval, times}, async () => {
|
|
61
|
+
return await openChannels({
|
|
62
|
+
lnd,
|
|
63
|
+
channels: [{capacity, partner_public_key: target.id}],
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
const acceptSub = subscribeToOpenRequests({lnd: target.lnd});
|
|
68
|
+
|
|
69
|
+
acceptSub.on('channel_request', request => {
|
|
70
|
+
equal(request.is_trusted_funding, true, 'Request is trusted funding');
|
|
71
|
+
|
|
72
|
+
return request.accept({is_trusted_funding: true});
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
// Propose the channel to the peer
|
|
76
|
+
const pending = await asyncRetry({interval, times}, async () => {
|
|
77
|
+
return await openChannel({
|
|
78
|
+
lnd,
|
|
79
|
+
is_trusted_funding: true,
|
|
80
|
+
local_tokens: capacity,
|
|
81
|
+
partner_public_key: target.id,
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
equal(pending.transaction_id.length, 64, 'Got transaction id');
|
|
86
|
+
equal(pending.transaction_vout, 0, 'Got transaction output index');
|
|
87
|
+
} catch (err) {
|
|
88
|
+
equal(err, null, 'No more error reported');
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
await kill({});
|
|
92
|
+
|
|
93
|
+
return;
|
|
94
|
+
});
|