paid-services 7.0.2 → 7.0.3

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,6 +1,6 @@
1
1
  # Versions
2
2
 
3
- ## Version 7.0.2
3
+ ## Version 7.0.3
4
4
 
5
5
  ### Breaking Changes
6
6
 
package/package.json CHANGED
@@ -17,18 +17,16 @@
17
17
  "ecpair": "2.1.0",
18
18
  "goldengate": "15.0.0",
19
19
  "invoices": "5.0.2",
20
- "ln-service": "58.0.2",
21
- "ln-sync": "7.0.0",
20
+ "ln-service": "58.0.4",
21
+ "ln-sync": "7.0.1",
22
22
  "psbt": "5.0.0",
23
23
  "p2tr": "2.0.0",
24
24
  "tiny-secp256k1": "2.2.4"
25
25
  },
26
26
  "description": "Lightning Paid Services library",
27
27
  "devDependencies": {
28
- "@alexbosworth/tap": "15.0.12",
29
28
  "ln-docker-daemons": "7.0.0",
30
- "mock-lnd": "2.0.0",
31
- "secp256k1": "5.0.1"
29
+ "mock-lnd": "3.0.0"
32
30
  },
33
31
  "engines": {
34
32
  "node": ">=20"
@@ -45,8 +43,8 @@
45
43
  "url": "https://github.com/alexbosworth/paid-services.git"
46
44
  },
47
45
  "scripts": {
48
- "integration-tests": "tap -j 1 --branches=1 --functions=1 --lines=1 --statements=1 -t 2700 test/integration/*.js",
46
+ "integration-tests": "node test/integration",
49
47
  "test": "tap --branches=1 --functions=1 --lines=1 --statements=1 -t 60 test/actions/*.js test/balanced/*.js test/capacity/*.js test/client/*.js test/config/*.js test/p2p/*.js test/records/*.js test/respond/*.js test/server/*.js test/swaps/*.js test/services/*.js test/trades/*.js"
50
48
  },
51
- "version": "7.0.2"
49
+ "version": "7.0.3"
52
50
  }
@@ -1,3 +1,6 @@
1
+ const {equal} = require('node:assert').strict;
2
+ const test = require('node:test');
3
+
1
4
  const {address} = require('bitcoinjs-lib');
2
5
  const asyncAuto = require('async/auto');
3
6
  const asyncMap = require('async/map');
@@ -12,7 +15,6 @@ const {getNetwork} = require('ln-sync');
12
15
  const {networks} = require('bitcoinjs-lib');
13
16
  const {openChannel} = require('ln-service');
14
17
  const {spawnLightningCluster} = require('ln-docker-daemons');
15
- const {test} = require('@alexbosworth/tap');
16
18
  const {Transaction} = require('bitcoinjs-lib');
17
19
 
18
20
  const accept = require('./../../capacity/accept_capacity_change');
@@ -38,7 +40,7 @@ const {toOutputScript} = address;
38
40
  const weightAsVBytes = n => Math.ceil(n / 4);
39
41
 
40
42
  // A capacity replacement proposal should be counter signed and accepted
41
- test(`Accept capacity replacement`, async ({end, equal, strictSame}) => {
43
+ test(`Accept capacity replacement`, async () => {
42
44
  const {kill, nodes} = await spawnLightningCluster({size});
43
45
 
44
46
  const [control, target] = nodes;
@@ -125,8 +127,6 @@ test(`Accept capacity replacement`, async ({end, equal, strictSame}) => {
125
127
  transaction_vout: channel.transaction_vout,
126
128
  });
127
129
 
128
- proposeDone = true;
129
-
130
130
  return;
131
131
  },
132
132
 
@@ -164,7 +164,7 @@ test(`Accept capacity replacement`, async ({end, equal, strictSame}) => {
164
164
  throw new Error('ExpectedChannelActivation');
165
165
  });
166
166
 
167
- strictSame(recreated.is_active, true, 'Recreated channel is active');
167
+ equal(recreated.is_active, true, 'Recreated channel is active');
168
168
  }],
169
169
 
170
170
  confirmControl: ['accept', 'propose', async ({}) => {
@@ -190,14 +190,12 @@ test(`Accept capacity replacement`, async ({end, equal, strictSame}) => {
190
190
  throw new Error('ExpectedChannelActivation');
191
191
  });
192
192
 
193
- strictSame(recreated.is_active, true, 'Recreated channel is active');
193
+ equal(recreated.is_active, true, 'Recreated channel is active');
194
194
  }],
195
195
  });
196
196
  } catch (err) {
197
- strictSame(err, null, 'Expected no failure');
197
+ equal(err, null, 'Expected no failure');
198
198
  } finally {
199
199
  await kill({});
200
200
  }
201
-
202
- return end();
203
201
  });
@@ -1,3 +1,6 @@
1
+ const {equal} = require('node:assert').strict;
2
+ const test = require('node:test');
3
+
1
4
  const {address} = require('bitcoinjs-lib');
2
5
  const asyncAuto = require('async/auto');
3
6
  const asyncMap = require('async/map');
@@ -12,7 +15,6 @@ const {getNetwork} = require('ln-sync');
12
15
  const {networks} = require('bitcoinjs-lib');
13
16
  const {openChannel} = require('ln-service');
14
17
  const {spawnLightningCluster} = require('ln-docker-daemons');
15
- const {test} = require('@alexbosworth/tap');
16
18
  const {Transaction} = require('bitcoinjs-lib');
17
19
 
18
20
  const {changeChannelCapacity} = require('./../../capacity');
@@ -32,7 +34,7 @@ const {toOutputScript} = address;
32
34
  const weightAsVBytes = n => Math.ceil(n / 4);
33
35
 
34
36
  // A capacity replacement proposal should be counter signed and accepted
35
- test(`Accept capacity replacement`, async ({end, equal, strictSame}) => {
37
+ test(`Accept capacity replacement`, async () => {
36
38
  const {kill, nodes} = await spawnLightningCluster({size});
37
39
 
38
40
  const [control, target] = nodes;
@@ -201,10 +203,8 @@ test(`Accept capacity replacement`, async ({end, equal, strictSame}) => {
201
203
  }],
202
204
  });
203
205
  } catch (err) {
204
- strictSame(err, null, 'Expected no failure');
206
+ equal(err, null, 'Expected no failure');
205
207
  } finally {
206
208
  await kill({});
207
209
  }
208
-
209
- return end();
210
210
  });
@@ -1,3 +1,6 @@
1
+ const {equal} = require('node:assert').strict;
2
+ const test = require('node:test');
3
+
1
4
  const {address} = require('bitcoinjs-lib');
2
5
  const asyncAuto = require('async/auto');
3
6
  const asyncMap = require('async/map');
@@ -12,7 +15,6 @@ const {getNetwork} = require('ln-sync');
12
15
  const {networks} = require('bitcoinjs-lib');
13
16
  const {openChannel} = require('ln-service');
14
17
  const {spawnLightningCluster} = require('ln-docker-daemons');
15
- const {test} = require('@alexbosworth/tap');
16
18
  const {Transaction} = require('bitcoinjs-lib');
17
19
 
18
20
  const {changeChannelCapacity} = require('./../../capacity');
@@ -32,7 +34,7 @@ const {toOutputScript} = address;
32
34
  const weightAsVBytes = n => Math.ceil(n / 4);
33
35
 
34
36
  // A capacity replacement proposal should be counter signed and accepted
35
- test(`Decrease capacity replacement`, async ({end, equal, strictSame}) => {
37
+ test(`Decrease capacity replacement`, async () => {
36
38
  const {kill, nodes} = await spawnLightningCluster({size});
37
39
 
38
40
  const [control, target] = nodes;
@@ -214,10 +216,8 @@ test(`Decrease capacity replacement`, async ({end, equal, strictSame}) => {
214
216
  }],
215
217
  });
216
218
  } catch (err) {
217
- strictSame(err, null, 'Expected no failure');
219
+ equal(err, null, 'Expected no failure');
218
220
  } finally {
219
221
  await kill({});
220
222
  }
221
-
222
- return end();
223
223
  });
@@ -1,4 +1,7 @@
1
- const {once} = require('events');
1
+ const {deepStrictEqual} = require('node:assert').strict;
2
+ const {equal} = require('node:assert').strict;
3
+ const {once} = require('node:events');
4
+ const test = require('node:test');
2
5
 
3
6
  const {addPeer} = require('ln-service');
4
7
  const asyncEach = require('async/each');
@@ -12,7 +15,6 @@ const {getUtxos} = require('ln-service');
12
15
  const {networks} = require('bitcoinjs-lib');
13
16
  const {sendToChainAddress} = require('ln-service');
14
17
  const {spawnLightningCluster} = require('ln-docker-daemons');
15
- const {test} = require('@alexbosworth/tap');
16
18
  const tinysecp = require('tiny-secp256k1');
17
19
 
18
20
  const assembleGroup = require('./../../groups/fanout/assemble_fanout_group');
@@ -24,7 +26,7 @@ const capacity = 1e5;
24
26
  const count = 101;
25
27
  const feeRate = 1;
26
28
  const format = 'p2tr';
27
- const interval = 10;
29
+ const interval = 50;
28
30
  const outputCount = 2;
29
31
  const outputCountControl = 4;
30
32
  const size = 3;
@@ -33,7 +35,7 @@ const times = 2000;
33
35
  const uniq = arr => Array.from(new Set(arr));
34
36
 
35
37
  // Make a joint transaction fanout group
36
- test(`Setup joint fanout group`, async ({end, equal, strictSame}) => {
38
+ test(`Setup joint fanout group`, async () => {
37
39
  const ecp = (await import('ecpair')).ECPairFactory(tinysecp);
38
40
  const {kill, nodes} = await spawnLightningCluster({size});
39
41
 
@@ -75,6 +77,8 @@ test(`Setup joint fanout group`, async ({end, equal, strictSame}) => {
75
77
 
76
78
  // Wait for UTXOs to be confirmed
77
79
  await asyncRetry({interval, times}, async () => {
80
+ await generate({});
81
+
78
82
  const remoteUtxos = await getUtxos({lnd: remote.lnd});
79
83
  const targetUtxos = await getUtxos({lnd: target.lnd});
80
84
 
@@ -152,7 +156,7 @@ test(`Setup joint fanout group`, async ({end, equal, strictSame}) => {
152
156
  // Transaction ids of the open should be returned
153
157
  const ids = joins.map(n => n.id);
154
158
 
155
- strictSame(uniq(ids).length, 1, 'Only one transaction id');
159
+ equal(uniq(ids).length, 1, 'Only one transaction id');
156
160
 
157
161
  // Finished, wait for confirmations on fanout utxos
158
162
  await generate({count});
@@ -183,7 +187,7 @@ test(`Setup joint fanout group`, async ({end, equal, strictSame}) => {
183
187
  .filter(n => n.tokens === capacity)
184
188
  .length;
185
189
 
186
- strictSame(utxosCount, count, 'Got expected UTXOs count');
190
+ equal(utxosCount, count, 'Got expected UTXOs count');
187
191
  });
188
192
  });
189
193
 
@@ -200,21 +204,19 @@ test(`Setup joint fanout group`, async ({end, equal, strictSame}) => {
200
204
  const changeOutput2 = components.outputs
201
205
  .find(n => n.tokens === 799809 || n.tokens === 799810);
202
206
 
203
- strictSame(components.inputs.length, 3, 'Got expected inputs count');
204
- strictSame(components.outputs.length, 11, 'Got expected outputs count');
205
- strictSame(fundedOuts.length, 8, 'Got expected funded outputs count');
206
- strictSame(!!changeOutput1, true, 'Got change output 1');
207
- strictSame(!!changeOutput2, true, 'Got change output 2');
208
- strictSame(!!controlExtra, true, 'Got control change output');
209
- strictSame(ids, [events.broadcast.id, events.broadcast.id], 'Got tx ids');
210
- strictSame(events.broadcast.id.length, 64, 'Got broadcast tx id');
211
- strictSame(!!events.broadcast.transaction, true, 'Got broadcast tx');
212
- strictSame(events.filled.ids.length, nodes.length, 'Got filled event');
207
+ equal(components.inputs.length, 3, 'Got expected inputs count');
208
+ equal(components.outputs.length, 11, 'Got expected outputs count');
209
+ equal(fundedOuts.length, 8, 'Got expected funded outputs count');
210
+ equal(!!changeOutput1, true, 'Got change output 1');
211
+ equal(!!changeOutput2, true, 'Got change output 2');
212
+ equal(!!controlExtra, true, 'Got control change output');
213
+ deepStrictEqual(ids, [events.broadcast.id, events.broadcast.id], 'Got id');
214
+ equal(events.broadcast.id.length, 64, 'Got broadcast tx id');
215
+ equal(!!events.broadcast.transaction, true, 'Got broadcast tx');
216
+ equal(events.filled.ids.length, nodes.length, 'Got filled event');
213
217
  } catch (err) {
214
- strictSame(err, null, 'Expected no failure');
218
+ equal(err, null, 'Expected no failure');
215
219
  } finally {
216
220
  await kill({});
217
221
  }
218
-
219
- return end();
220
222
  });
@@ -1,4 +1,7 @@
1
- const {once} = require('events');
1
+ const {deepStrictEqual} = require('node:assert').strict;
2
+ const {equal} = require('node:assert').strict;
3
+ const {once} = require('node:events');
4
+ const test = require('node:test');
2
5
 
3
6
  const {addPeer} = require('ln-service');
4
7
  const asyncMap = require('async/map');
@@ -11,7 +14,6 @@ const {getUtxos} = require('ln-service');
11
14
  const {networks} = require('bitcoinjs-lib');
12
15
  const {sendToChainAddress} = require('ln-service');
13
16
  const {spawnLightningCluster} = require('ln-docker-daemons');
14
- const {test} = require('@alexbosworth/tap');
15
17
  const tinysecp = require('tiny-secp256k1');
16
18
 
17
19
  const assembleChannelGroup = require('./../../groups/assemble_channel_group');
@@ -28,7 +30,7 @@ const tokens = 1e6;
28
30
  const times = 2000;
29
31
 
30
32
  // Make a joint transaction channel group
31
- test(`Setup joint channel group`, async ({end, equal, strictSame}) => {
33
+ test(`Setup joint channel group`, async () => {
32
34
  const ecp = (await import('ecpair')).ECPairFactory(tinysecp);
33
35
  const {kill, nodes} = await spawnLightningCluster({size});
34
36
 
@@ -138,8 +140,8 @@ test(`Setup joint channel group`, async ({end, equal, strictSame}) => {
138
140
 
139
141
  const [{inbound, outbound}] = await once(join, 'peering');
140
142
 
141
- strictSame(!!inbound, true, 'Received inbound peer');
142
- strictSame(!!outbound, true, 'Received outbound peer');
143
+ equal(!!inbound, true, 'Received inbound peer');
144
+ equal(!!outbound, true, 'Received outbound peer');
143
145
 
144
146
  const [tx] = await once(join, 'end');
145
147
 
@@ -160,15 +162,13 @@ test(`Setup joint channel group`, async ({end, equal, strictSame}) => {
160
162
  }
161
163
  });
162
164
 
163
- strictSame(ids, [events.broadcast.id, events.broadcast.id], 'Got tx ids');
164
- strictSame(events.broadcast.id.length, 64, 'Got broadcast tx id');
165
- strictSame(!!events.broadcast.transaction, true, 'Got broadcast tx');
166
- strictSame(events.filled.ids.length, nodes.length, 'Got filled event');
165
+ deepStrictEqual(ids, [events.broadcast.id, events.broadcast.id], 'Got tx ids');
166
+ equal(events.broadcast.id.length, 64, 'Got broadcast tx id');
167
+ equal(!!events.broadcast.transaction, true, 'Got broadcast tx');
168
+ equal(events.filled.ids.length, nodes.length, 'Got filled event');
167
169
  } catch (err) {
168
- strictSame(err, null, 'Expected no failure');
170
+ equal(err, null, 'Expected no failure');
169
171
  } finally {
170
172
  await kill({});
171
173
  }
172
-
173
- return end();
174
174
  });
@@ -1,8 +1,8 @@
1
- const {once} = require('events');
1
+ const {equal} = require('node:assert').strict;
2
+ const test = require('node:test');
2
3
 
3
4
  const {addPeer} = require('ln-service');
4
5
  const asyncAuto = require('async/auto');
5
- const asyncMap = require('async/map');
6
6
  const asyncRetry = require('async/retry');
7
7
  const {createChainAddress} = require('ln-service');
8
8
  const {getChainTransactions} = require('ln-service');
@@ -12,7 +12,6 @@ const {getUtxos} = require('ln-service');
12
12
  const {networks} = require('bitcoinjs-lib');
13
13
  const {sendToChainAddress} = require('ln-service');
14
14
  const {spawnLightningCluster} = require('ln-docker-daemons');
15
- const {test} = require('@alexbosworth/tap');
16
15
 
17
16
  const {createGroupChannel} = require('./../../');
18
17
  const {joinGroupChannel} = require('./../../');
@@ -26,7 +25,7 @@ const tokens = 1e6;
26
25
  const times = 2000;
27
26
 
28
27
  // Make a joint transaction channel group non-interactively
29
- test(`Setup joint channel group`, async ({end, equal, strictSame}) => {
28
+ test(`Setup joint channel group`, async () => {
30
29
  const {kill, nodes} = await spawnLightningCluster({size});
31
30
 
32
31
  const [control, target] = nodes;
@@ -121,12 +120,10 @@ test(`Setup joint channel group`, async ({end, equal, strictSame}) => {
121
120
 
122
121
  const ids = [group.join.transaction_id, group.create.transaction_id];
123
122
 
124
- strictSame(ids.length, nodes.length, 'Got tx ids');
123
+ equal(ids.length, nodes.length, 'Got tx ids');
125
124
  } catch (err) {
126
- strictSame(err, null, 'Expected no failure');
125
+ equal(err, null, 'Expected no failure');
127
126
  } finally {
128
127
  await kill({});
129
128
  }
130
-
131
- return end();
132
129
  });
@@ -1,4 +1,7 @@
1
- const {once} = require('events');
1
+ const {deepStrictEqual} = require('node:assert').strict;
2
+ const {equal} = require('node:assert').strict;
3
+ const {once} = require('node:events');
4
+ const test = require('node:test');
2
5
 
3
6
  const {addPeer} = require('ln-service');
4
7
  const asyncMap = require('async/map');
@@ -11,7 +14,6 @@ const {getUtxos} = require('ln-service');
11
14
  const {networks} = require('bitcoinjs-lib');
12
15
  const {sendToChainAddress} = require('ln-service');
13
16
  const {spawnLightningCluster} = require('ln-docker-daemons');
14
- const {test} = require('@alexbosworth/tap');
15
17
  const tinysecp = require('tiny-secp256k1');
16
18
 
17
19
  const assembleChannelGroup = require('./../../groups/assemble_channel_group');
@@ -28,7 +30,7 @@ const tokens = 1e6;
28
30
  const times = 2000;
29
31
 
30
32
  // Make a joint transaction channel group
31
- test(`Setup joint channel group`, async ({end, equal, strictSame}) => {
33
+ test(`Setup joint channel group`, async () => {
32
34
  const ecp = (await import('ecpair')).ECPairFactory(tinysecp);
33
35
  const {kill, nodes} = await spawnLightningCluster({size});
34
36
 
@@ -129,15 +131,13 @@ test(`Setup joint channel group`, async ({end, equal, strictSame}) => {
129
131
  }
130
132
  });
131
133
 
132
- strictSame(ids, [events.broadcast.id], 'Got tx ids');
133
- strictSame(events.broadcast.id.length, 64, 'Got broadcast tx id');
134
- strictSame(!!events.broadcast.transaction, true, 'Got broadcast tx');
135
- strictSame(events.filled.ids.length, nodes.length, 'Got filled event');
134
+ deepStrictEqual(ids, [events.broadcast.id], 'Got tx ids');
135
+ equal(events.broadcast.id.length, 64, 'Got broadcast tx id');
136
+ equal(!!events.broadcast.transaction, true, 'Got broadcast tx');
137
+ equal(events.filled.ids.length, nodes.length, 'Got filled event');
136
138
  } catch (err) {
137
- strictSame(err, null, 'Expected no failure');
139
+ equal(err, null, 'Expected no failure');
138
140
  } finally {
139
141
  await kill({});
140
142
  }
141
-
142
- return end();
143
143
  });
@@ -1,4 +1,6 @@
1
- const {once} = require('events');
1
+ const {equal} = require('node:assert').strict;
2
+ const {once} = require('node:events');
3
+ const test = require('node:test');
2
4
 
3
5
  const {addPeer} = require('ln-service');
4
6
  const asyncMap = require('async/map');
@@ -11,7 +13,6 @@ const {getUtxos} = require('ln-service');
11
13
  const {networks} = require('bitcoinjs-lib');
12
14
  const {sendToChainAddress} = require('ln-service');
13
15
  const {spawnLightningCluster} = require('ln-docker-daemons');
14
- const {test} = require('@alexbosworth/tap');
15
16
  const tinysecp = require('tiny-secp256k1');
16
17
 
17
18
  const assembleChannelGroup = require('./../../groups/assemble_channel_group');
@@ -28,7 +29,7 @@ const tokens = 1e6;
28
29
  const times = 2000;
29
30
 
30
31
  // Make a joint transaction channel group with a sort defined
31
- test(`Setup sorted channel group`, async ({end, equal, strictSame}) => {
32
+ test(`Setup sorted channel group`, async () => {
32
33
  const ecp = (await import('ecpair')).ECPairFactory(tinysecp);
33
34
  const {kill, nodes} = await spawnLightningCluster({size});
34
35
 
@@ -149,26 +150,26 @@ test(`Setup sorted channel group`, async ({end, equal, strictSame}) => {
149
150
 
150
151
  switch (node.id) {
151
152
  case (extra.id):
152
- strictSame(inbound, control.id, 'Extra inbound is control');
153
- strictSame(outbound, remote.id, 'Extra outbound is remote');
153
+ equal(inbound, control.id, 'Extra inbound is control');
154
+ equal(outbound, remote.id, 'Extra outbound is remote');
154
155
  break;
155
156
 
156
157
  case (remote.id):
157
- strictSame(inbound, extra.id, 'Remote inbound is extra');
158
- strictSame(outbound, target.id, 'Remote outbound is target');
158
+ equal(inbound, extra.id, 'Remote inbound is extra');
159
+ equal(outbound, target.id, 'Remote outbound is target');
159
160
  break;
160
161
 
161
162
  case (target.id):
162
- strictSame(inbound, remote.id, 'Target inbound is remote');
163
- strictSame(outbound, control.id, 'Target outbound is control');
163
+ equal(inbound, remote.id, 'Target inbound is remote');
164
+ equal(outbound, control.id, 'Target outbound is control');
164
165
  break;
165
166
 
166
167
  default:
167
168
  break;
168
169
  }
169
170
 
170
- strictSame(!!inbound, true, 'Received inbound peer');
171
- strictSame(!!outbound, true, 'Received outbound peer');
171
+ equal(!!inbound, true, 'Received inbound peer');
172
+ equal(!!outbound, true, 'Received outbound peer');
172
173
 
173
174
  const [tx] = await once(join, 'end');
174
175
 
@@ -189,14 +190,12 @@ test(`Setup sorted channel group`, async ({end, equal, strictSame}) => {
189
190
  }
190
191
  });
191
192
 
192
- strictSame(events.broadcast.id.length, 64, 'Got broadcast tx id');
193
- strictSame(!!events.broadcast.transaction, true, 'Got broadcast tx');
194
- strictSame(events.filled.ids.length, nodes.length, 'Got filled event');
193
+ equal(events.broadcast.id.length, 64, 'Got broadcast tx id');
194
+ equal(!!events.broadcast.transaction, true, 'Got broadcast tx');
195
+ equal(events.filled.ids.length, nodes.length, 'Got filled event');
195
196
  } catch (err) {
196
- strictSame(err, null, 'Expected no failure');
197
+ equal(err, null, 'Expected no failure');
197
198
  } finally {
198
199
  await kill({});
199
200
  }
200
-
201
- return end();
202
201
  });
@@ -1,3 +1,6 @@
1
+ const {equal} = require('node:assert').strict;
2
+ const test = require('node:test');
3
+
1
4
  const {address} = require('bitcoinjs-lib');
2
5
  const asyncAuto = require('async/auto');
3
6
  const asyncMap = require('async/map');
@@ -12,7 +15,6 @@ const {getNetwork} = require('ln-sync');
12
15
  const {networks} = require('bitcoinjs-lib');
13
16
  const {openChannel} = require('ln-service');
14
17
  const {spawnLightningCluster} = require('ln-docker-daemons');
15
- const {test} = require('@alexbosworth/tap');
16
18
  const {Transaction} = require('bitcoinjs-lib');
17
19
 
18
20
  const {changeChannelCapacity} = require('./../../capacity');
@@ -31,7 +33,7 @@ const {toOutputScript} = address;
31
33
  const weightAsVBytes = n => Math.ceil(n / 4);
32
34
 
33
35
  // A capacity replacement proposal should be counter signed and accepted
34
- test(`Accept capacity replacement`, async ({end, equal, strictSame}) => {
36
+ test(`Accept capacity replacement`, async () => {
35
37
  const {kill, nodes} = await spawnLightningCluster({size});
36
38
 
37
39
  const [control, target] = nodes;
@@ -193,10 +195,8 @@ test(`Accept capacity replacement`, async ({end, equal, strictSame}) => {
193
195
  }],
194
196
  });
195
197
  } catch (err) {
196
- strictSame(err, null, 'Expected no failure');
198
+ equal(err, null, 'Expected no failure');
197
199
  } finally {
198
200
  await kill({});
199
201
  }
200
-
201
- return end();
202
202
  });
@@ -1,3 +1,6 @@
1
+ const {equal} = require('node:assert').strict;
2
+ const test = require('node:test');
3
+
1
4
  const {addPeer} = require('ln-service');
2
5
  const {address} = require('bitcoinjs-lib');
3
6
  const asyncAuto = require('async/auto');
@@ -13,7 +16,6 @@ const {getNetwork} = require('ln-sync');
13
16
  const {networks} = require('bitcoinjs-lib');
14
17
  const {openChannel} = require('ln-service');
15
18
  const {spawnLightningCluster} = require('ln-docker-daemons');
16
- const {test} = require('@alexbosworth/tap');
17
19
  const {Transaction} = require('bitcoinjs-lib');
18
20
 
19
21
  const {changeChannelCapacity} = require('./../../capacity');
@@ -33,7 +35,7 @@ const {toOutputScript} = address;
33
35
  const weightAsVBytes = n => Math.ceil(n / 4);
34
36
 
35
37
  // A capacity movement proposal should be counter signed and accepted
36
- test(`Move channel capacity`, async ({end, equal, strictSame}) => {
38
+ test(`Move channel capacity`, async () => {
37
39
  const {kill, nodes} = await spawnLightningCluster({size});
38
40
 
39
41
  const [control, target, remote] = nodes;
@@ -221,10 +223,8 @@ test(`Move channel capacity`, async ({end, equal, strictSame}) => {
221
223
  }],
222
224
  });
223
225
  } catch (err) {
224
- strictSame(err, null, 'Expected no failure');
226
+ equal(err, null, 'Expected no failure');
225
227
  } finally {
226
228
  await kill({});
227
229
  }
228
-
229
- return end();
230
230
  });
@@ -1,3 +1,6 @@
1
+ const {equal} = require('node:assert').strict;
2
+ const test = require('node:test');
3
+
1
4
  const asyncRetry = require('async/retry');
2
5
  const {broadcastChainTransaction} = require('ln-service');
3
6
  const {createChainAddress} = require('ln-service');
@@ -9,7 +12,6 @@ const {openChannel} = require('ln-service');
9
12
  const {pay} = require('ln-service');
10
13
  const {sendToChainAddress} = require('ln-service');
11
14
  const {spawnLightningCluster} = require('ln-docker-daemons');
12
- const {test} = require('@alexbosworth/tap');
13
15
 
14
16
  const requestSwapOut = require('./../../swaps/request_swap_out');
15
17
  const respondToSwapOut = require('./../../swaps/respond_to_swap_out_request');
@@ -24,7 +26,7 @@ const times = 3000;
24
26
  const tokens = 1e5;
25
27
 
26
28
  // Start an offchain swap
27
- test(`Start offchain swap`, async ({end, equal, strictSame}) => {
29
+ test(`Start offchain swap`, async () => {
28
30
  const {kill, nodes} = await spawnLightningCluster({size});
29
31
 
30
32
  const [{generate, id, lnd}, target] = nodes;
@@ -35,7 +37,7 @@ test(`Start offchain swap`, async ({end, equal, strictSame}) => {
35
37
  if (!keys.find(n => n.derivation_path === taprootDerivationPath)) {
36
38
  await kill({});
37
39
 
38
- return end();
40
+ return;
39
41
  }
40
42
 
41
43
  try {
@@ -166,10 +168,8 @@ test(`Start offchain swap`, async ({end, equal, strictSame}) => {
166
168
  min_confirmations: 3,
167
169
  });
168
170
  } catch (err) {
169
- strictSame(err, null, 'Expected no failure');
171
+ equal(err, null, 'Expected no failure');
170
172
  }
171
173
 
172
174
  await kill({});
173
-
174
- return end();
175
- });
175
+ });
@@ -1,6 +1,9 @@
1
+ const {deepStrictEqual} = require('node:assert').strict;
2
+ const {equal} = require('node:assert').strict;
3
+ const test = require('node:test');
4
+
1
5
  const {addPeer} = require('ln-service');
2
6
  const {spawnLightningCluster} = require('ln-docker-daemons');
3
- const {test} = require('@alexbosworth/tap');
4
7
 
5
8
  const {makePeerRequest} = require('./../../');
6
9
  const {servicePeerRequests} = require('./../../');
@@ -12,7 +15,7 @@ const size = 2;
12
15
  const type = '0';
13
16
 
14
17
  // Adding a listener for peer requests should allow responding to peer requests
15
- test(`Listen for peer requests`, async ({end, equal, strictSame}) => {
18
+ test(`Listen for peer requests`, async () => {
16
19
  const {kill, nodes} = await spawnLightningCluster({size});
17
20
 
18
21
  const [{id, lnd}, target] = nodes;
@@ -34,7 +37,7 @@ test(`Listen for peer requests`, async ({end, equal, strictSame}) => {
34
37
  to: id,
35
38
  });
36
39
 
37
- strictSame(records, got.records, 'Got response records');
40
+ deepStrictEqual(records, got.records, 'Got response records');
38
41
  } catch (err) {
39
42
  equal(err, null, 'Expected no error making peer request');
40
43
  }
@@ -48,12 +51,10 @@ test(`Listen for peer requests`, async ({end, equal, strictSame}) => {
48
51
  to: id,
49
52
  });
50
53
 
51
- strictSame(got, null, 'Expected failure response for failure type');
54
+ equal(got, null, 'Expected failure response for failure type');
52
55
  } catch (err) {
53
- strictSame(err, failure, 'Got failure response for failure type');
56
+ deepStrictEqual(err, failure, 'Got failure response for failure type');
54
57
  }
55
58
 
56
59
  await kill({});
57
-
58
- return end();
59
60
  });
@@ -1,3 +1,6 @@
1
+ const {equal} = require('node:assert').strict;
2
+ const test = require('node:test');
3
+
1
4
  const {address} = require('bitcoinjs-lib');
2
5
  const asyncMap = require('async/map');
3
6
  const asyncRetry = require('async/retry');
@@ -9,7 +12,6 @@ const {getChannels} = require('ln-service');
9
12
  const {networks} = require('bitcoinjs-lib');
10
13
  const {openChannel} = require('ln-service');
11
14
  const {spawnLightningCluster} = require('ln-docker-daemons');
12
- const {test} = require('@alexbosworth/tap');
13
15
  const {Transaction} = require('bitcoinjs-lib');
14
16
 
15
17
  const finalize = require('./../../capacity/finalize_capacity_replacement');
@@ -31,7 +33,7 @@ const {toOutputScript} = address;
31
33
  const weightAsVBytes = n => Math.ceil(n / 4);
32
34
 
33
35
  // Signing a capacity replacement transaction should result in a valid sig
34
- test(`Sign capacity replacement`, async ({end, equal, strictSame}) => {
36
+ test(`Sign capacity replacement`, async () => {
35
37
  const {kill, nodes} = await spawnLightningCluster({size});
36
38
 
37
39
  const [{generate, lnd}, target] = nodes;
@@ -133,12 +135,10 @@ test(`Sign capacity replacement`, async ({end, equal, strictSame}) => {
133
135
  return tx.id === fromHex(transaction).getId();
134
136
  });
135
137
 
136
- strictSame(done.is_confirmed, true, 'Signed replacement is confirmed');
138
+ equal(done.is_confirmed, true, 'Signed replacement is confirmed');
137
139
  } catch (err) {
138
- strictSame(err, null, 'Expected no failure');
140
+ equal(err, null, 'Expected no failure');
139
141
  } finally {
140
142
  await kill({});
141
143
  }
142
-
143
- return end();
144
144
  });
@@ -1,3 +1,6 @@
1
+ const {equal} = require('node:assert').strict;
2
+ const test = require('node:test');
3
+
1
4
  const {addPeer} = require('ln-service');
2
5
  const {address} = require('bitcoinjs-lib');
3
6
  const asyncAuto = require('async/auto');
@@ -13,7 +16,6 @@ const {getNetwork} = require('ln-sync');
13
16
  const {networks} = require('bitcoinjs-lib');
14
17
  const {openChannel} = require('ln-service');
15
18
  const {spawnLightningCluster} = require('ln-docker-daemons');
16
- const {test} = require('@alexbosworth/tap');
17
19
  const {Transaction} = require('bitcoinjs-lib');
18
20
 
19
21
  const {changeChannelCapacity} = require('./../../capacity');
@@ -35,7 +37,7 @@ const {toOutputScript} = address;
35
37
  const weightAsVBytes = n => Math.ceil(n / 4);
36
38
 
37
39
  // A capacity replacement proposal should be counter signed and accepted
38
- test(`Decrease capacity replacement`, async ({end, equal, strictSame}) => {
40
+ test(`Decrease capacity replacement`, async () => {
39
41
  const {kill, nodes} = await spawnLightningCluster({size});
40
42
 
41
43
  const [control, target, remote] = nodes;
@@ -234,10 +236,8 @@ test(`Decrease capacity replacement`, async ({end, equal, strictSame}) => {
234
236
  }],
235
237
  });
236
238
  } catch (err) {
237
- strictSame(err, null, 'Expected no failure');
239
+ equal(err, null, 'Expected no failure');
238
240
  } finally {
239
241
  await kill({});
240
242
  }
241
-
242
- return end();
243
243
  });
@@ -1,3 +1,6 @@
1
+ const {equal} = require('node:assert').strict;
2
+ const test = require('node:test');
3
+
1
4
  const asyncRetry = require('async/retry');
2
5
  const {broadcastChainTransaction} = require('ln-service');
3
6
  const {createChainAddress} = require('ln-service');
@@ -9,7 +12,6 @@ const {openChannel} = require('ln-service');
9
12
  const {pay} = require('ln-service');
10
13
  const {sendToChainAddress} = require('ln-service');
11
14
  const {spawnLightningCluster} = require('ln-docker-daemons');
12
- const {test} = require('@alexbosworth/tap');
13
15
 
14
16
  const requestSwapOut = require('./../../swaps/request_swap_out');
15
17
  const respondToSwapOut = require('./../../swaps/respond_to_swap_out_request');
@@ -24,7 +26,7 @@ const times = 3000;
24
26
  const tokens = 1e5;
25
27
 
26
28
  // Start an offchain swap but use the claim path to sweep
27
- test(`Swap with claim path`, async ({end, equal, strictSame}) => {
29
+ test(`Swap with claim path`, async () => {
28
30
  const {kill, nodes} = await spawnLightningCluster({size});
29
31
 
30
32
  const [{generate, id, lnd}, target] = nodes;
@@ -35,7 +37,7 @@ test(`Swap with claim path`, async ({end, equal, strictSame}) => {
35
37
  if (!keys.find(n => n.derivation_path === taprootDerivationPath)) {
36
38
  await kill({});
37
39
 
38
- return end();
40
+ return;
39
41
  }
40
42
 
41
43
  try {
@@ -168,10 +170,8 @@ test(`Swap with claim path`, async ({end, equal, strictSame}) => {
168
170
  },
169
171
  });
170
172
  } catch (err) {
171
- strictSame(err, null, 'Expected no failure');
173
+ equal(err, null, 'Expected no failure');
172
174
  }
173
175
 
174
176
  await kill({});
175
-
176
- return end();
177
- });
177
+ });
@@ -1,3 +1,7 @@
1
+ const {deepStrictEqual} = require('node:assert').strict;
2
+ const {equal} = require('node:assert').strict;
3
+ const test = require('node:test');
4
+
1
5
  const asyncRetry = require('async/retry');
2
6
  const {createChainAddress} = require('ln-service');
3
7
  const {createInvoice} = require('ln-service');
@@ -8,7 +12,6 @@ const {openChannel} = require('ln-service');
8
12
  const {pay} = require('ln-service');
9
13
  const {sendToChainAddress} = require('ln-service');
10
14
  const {spawnLightningCluster} = require('ln-docker-daemons');
11
- const {test} = require('@alexbosworth/tap');
12
15
 
13
16
  const requestSwapOut = require('./../../swaps/request_swap_out');
14
17
  const respondToSwapOut = require('./../../swaps/respond_to_swap_out_request');
@@ -23,7 +26,7 @@ const times = 3000;
23
26
  const tokens = 1e5;
24
27
 
25
28
  // Start an offchain swap but do not cooperate and eventually force a refund
26
- test(`Timeout a swap`, async ({end, equal, strictSame}) => {
29
+ test(`Timeout a swap`, async () => {
27
30
  const {kill, nodes} = await spawnLightningCluster({size});
28
31
 
29
32
  const [{generate, id, lnd}, target] = nodes;
@@ -37,7 +40,7 @@ test(`Timeout a swap`, async ({end, equal, strictSame}) => {
37
40
  if (!keys.find(n => n.derivation_path === taprootDerivationPath)) {
38
41
  await kill({});
39
42
 
40
- return end();
43
+ return;
41
44
  }
42
45
 
43
46
  try {
@@ -153,7 +156,7 @@ test(`Timeout a swap`, async ({end, equal, strictSame}) => {
153
156
  },
154
157
  });
155
158
  } catch (err) {
156
- strictSame(err, [503, 'SwapFailedViaTimeout']);
159
+ deepStrictEqual(err, [503, 'SwapFailedViaTimeout']);
157
160
 
158
161
  return;
159
162
  }
@@ -180,14 +183,12 @@ test(`Timeout a swap`, async ({end, equal, strictSame}) => {
180
183
  } catch (err) {
181
184
  const [, msg] = err;
182
185
 
183
- strictSame(msg, 'PaymentRejectedByDestination', 'Expected failed swap');
186
+ equal(msg, 'PaymentRejectedByDestination', 'Expected failed swap');
184
187
  }
185
188
 
186
189
  const complete = responder.find(n => !!n.swap_timeout_complete);
187
190
 
188
- strictSame(!!complete, true, 'Swap refund completed');
191
+ equal(!!complete, true, 'Swap refund completed');
189
192
 
190
193
  await kill({});
191
-
192
- return end();
193
- });
194
+ });
@@ -0,0 +1,18 @@
1
+ const {join} = require('node:path');
2
+ const {readdirSync} = require('node:fs');
3
+ const {run} = require('node:test');
4
+ const {tap} = require('node:test/reporters');
5
+
6
+ const concurrency = 1;
7
+ const timeout = 1000 * 60 * 5;
8
+
9
+ const dirs = ['integration'];
10
+
11
+ const asPath = file => join(file.path || file.parentPath, file.name);
12
+ const flatten = arr => [].concat(...arr);
13
+
14
+ const files = flatten(dirs.map(dir => {
15
+ return readdirSync(join(__dirname, dir), {withFileTypes: true}).map(asPath);
16
+ }));
17
+
18
+ run({concurrency, files, timeout}).compose(tap).pipe(process.stdout);