ln-service 59.1.2 → 59.2.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,10 @@
1
1
  # Versions
2
2
 
3
+ ## 59.2.0
4
+
5
+ - `openChannel`, `openChannels`: Add support for standard P2TR channels:
6
+ `is_standard_taproot`
7
+
3
8
  ## 59.1.2
4
9
 
5
10
  - Add support for LND 0.21.1
package/README.md CHANGED
@@ -4079,6 +4079,9 @@ Requires `offchain:write`, `onchain:write`, `peers:write` permissions
4079
4079
  `inputs` is not supported on LND 0.16.4 and below
4080
4080
 
4081
4081
  `is_simplified_taproot` is not supported on LND 0.16.4 and below and requires
4082
+ `--protocol.simple-taproot-chans` set on both sides.
4083
+
4084
+ `is_standard_taproot` is not supported on LND 0.21.0 and below and requires
4082
4085
  `--protocol.simple-taproot-chans` set on both sides.
4083
4086
 
4084
4087
  {
@@ -4096,6 +4099,7 @@ Requires `offchain:write`, `onchain:write`, `peers:write` permissions
4096
4099
  [is_max_funding]: <Use Maximal Chain Funds For Local Funding Bool>
4097
4100
  [is_private]: <Channel is Private Bool> // Defaults to false
4098
4101
  [is_simplified_taproot]: <Channel is Simplified Taproot Type Bool>
4102
+ [is_standard_taproot]: <Channel is Standard Taproot Type Bool>
4099
4103
  [is_trusted_funding]: <Accept Funding as Trusted Bool>
4100
4104
  lnd: <Authenticated LND API Object>
4101
4105
  local_tokens: <Total Channel Capacity Tokens Number>
@@ -4148,6 +4152,9 @@ as well as a channel open request listener to accept the trusted funding.
4148
4152
  `description` is not supported on LND 0.16.4 and below
4149
4153
 
4150
4154
  `is_simplified_taproot` is not supported on LND 0.16.4 and below and requires
4155
+ `--protocol.simple-taproot-chans` set on both sides.
4156
+
4157
+ `is_standard_taproot` is not supported on LND 0.21.0 and below and requires
4151
4158
  `--protocol.simple-taproot-chans` set on both sides.
4152
4159
 
4153
4160
  {
@@ -4161,6 +4168,7 @@ as well as a channel open request listener to accept the trusted funding.
4161
4168
  [is_allowing_minimal_reserve]: <Allow Peer to Have Minimal Reserve Bool>
4162
4169
  [is_private]: <Channel is Private Bool> // Defaults to false
4163
4170
  [is_simplified_taproot]: <Channel is Simplified Taproot Type Bool>
4171
+ [is_standard_taproot]: <Channel is Standard Taproot Type Bool>
4164
4172
  [is_trusted_funding]: <Peer Should Avoid Waiting For Confirmation Bool>
4165
4173
  [min_htlc_mtokens]: <Minimum HTLC Millitokens String>
4166
4174
  [partner_csv_delay]: <Peer Output CSV Delay Number>
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "dependencies": {
10
10
  "bolt07": "1.9.5",
11
11
  "invoices": "5.0.2",
12
- "lightning": "12.1.2",
12
+ "lightning": "12.2.0",
13
13
  "macaroon": "3.0.4"
14
14
  },
15
15
  "description": "Interaction helper for your Lightning Network daemon",
@@ -56,5 +56,5 @@
56
56
  "integration-test-0.20.0": "DOCKER_LND_VERSION=v0.20.0-beta npm run test",
57
57
  "test": "echo $DOCKER_LND_VERSION && node test/runner"
58
58
  },
59
- "version": "59.1.2"
59
+ "version": "59.2.0"
60
60
  }
@@ -0,0 +1,94 @@
1
+ const {equal} = require('node:assert').strict;
2
+ const test = require('node:test');
3
+
4
+ const asyncRetry = require('async/retry');
5
+ const {spawnLightningCluster} = require('ln-docker-daemons');
6
+
7
+ const {addPeer} = require('./../../');
8
+ const {broadcastChainTransaction} = require('./../../');
9
+ const {fundPendingChannels} = require('./../../');
10
+ const {fundPsbt} = require('./../../');
11
+ const {getChannels} = require('./../../');
12
+ const {openChannel} = require('./../../');
13
+ const {openChannels} = require('./../../');
14
+ const {signPsbt} = require('./../../');
15
+
16
+ const channelCapacityTokens = 1e6;
17
+ const count = 100;
18
+ const defaultFee = 1e3;
19
+ const description = 'description';
20
+ const interval = 250;
21
+ const size = 2;
22
+ const times = 1000;
23
+
24
+ // Opening a standard taproot channel should open a standard taproot channel
25
+ test(`Open standard taproot channel`, async () => {
26
+ // Test for LND 0.20.0 or below to exit early and avoid test
27
+ {
28
+ }
29
+
30
+ const {kill, nodes} = await spawnLightningCluster({
31
+ size,
32
+ lnd_configuration: ['--protocol.simple-taproot-chans'],
33
+ });
34
+
35
+ const [{generate, id, lnd}, target] = nodes;
36
+
37
+ // Try opening a standard taproot channel
38
+ try {
39
+ await generate({count});
40
+
41
+ await addPeer({lnd, public_key: target.id, socket: target.socket});
42
+
43
+ const channelOpen = await asyncRetry({interval, times}, async () => {
44
+ await addPeer({lnd, public_key: target.id, socket: target.socket});
45
+
46
+ try {
47
+ return await openChannel({
48
+ lnd,
49
+ chain_fee_tokens_per_vbyte: defaultFee,
50
+ is_private: true,
51
+ is_standard_taproot: true,
52
+ local_tokens: channelCapacityTokens,
53
+ partner_public_key: target.id,
54
+ socket: target.socket,
55
+ });
56
+ } catch (err) {
57
+ const [code, message, details] = err;
58
+
59
+ if (!!details && details.err === 'unhandled request channel type 7') {
60
+ return;
61
+ } else {
62
+ throw err;
63
+ }
64
+ }
65
+ });
66
+
67
+ // Exit early when there is no support for standard taproot
68
+ if (!channelOpen) {
69
+ return await kill({});
70
+ }
71
+
72
+ const channel = await asyncRetry({interval, times}, async () => {
73
+ await generate({});
74
+
75
+ const {channels} = await getChannels({lnd});
76
+
77
+ const [channel] = channels;
78
+
79
+ if (!channel) {
80
+ throw new Error('ExpectedChannelOpened');
81
+ }
82
+
83
+ return channel;
84
+ });
85
+
86
+ equal(channel.type, 'standard_taproot', 'Opened standard taproot');
87
+ } catch (err) {
88
+ equal(err, null, 'Expected no error');
89
+ } finally {
90
+ await kill({});
91
+ }
92
+
93
+ return;
94
+ });