@@ -88,7 +88,11 @@ def test_echo_init(runner: Runner, namespaceoverride: Any) -> None:
88
88
test = [
89
89
Connect (connprivkey = "03" ),
90
90
ExpectMsg ("init" ),
91
- Msg ("init" , globalfeatures = "" , features = "" ),
91
+ Msg (
92
+ "init" ,
93
+ globalfeatures = runner .runner_features (globals = True ),
94
+ features = runner .runner_features (),
95
+ ),
92
96
# optionally disconnect that first one
93
97
Connect (connprivkey = "02" ),
94
98
# You should always handle us echoing your own features back!
@@ -105,7 +109,11 @@ def test_echo_init_after_disconnect(runner: Runner, namespaceoverride: Any) -> N
105
109
test = [
106
110
Connect (connprivkey = "03" ),
107
111
ExpectMsg ("init" ),
108
- Msg ("init" , globalfeatures = "" , features = "" ),
112
+ Msg (
113
+ "init" ,
114
+ globalfeatures = runner .runner_features (globals = True ),
115
+ features = runner .runner_features (),
116
+ ),
109
117
# optionally disconnect that first one
110
118
Disconnect (),
111
119
Connect (connprivkey = "02" ),
@@ -123,7 +131,13 @@ def test_init_check_received_msg(runner: Runner, namespaceoverride: Any) -> None
123
131
sequences = [
124
132
Connect (connprivkey = "03" ),
125
133
ExpectMsg ("init" ),
126
- Msg ("init" , globalfeatures = "" , features = "" ),
134
+ Msg (
135
+ "init" ,
136
+ globalfeatures = runner .runner_features (globals = True ),
137
+ features = runner .runner_features (),
138
+ ),
139
+ # optionally disconnect that first one
140
+ TryAll ([], Disconnect ()),
127
141
Connect (connprivkey = "02" ),
128
142
# Even if we don't send anything, it should send init.
129
143
ExpectMsg ("init" , if_match = no_gf13 ),
@@ -137,13 +151,25 @@ def test_init_invalid_globalfeatures(runner: Runner, namespaceoverride: Any) ->
137
151
sequences = [
138
152
Connect (connprivkey = "03" ),
139
153
ExpectMsg ("init" ),
140
- Msg ("init" , globalfeatures = "" , features = "" ),
154
+ Msg (
155
+ "init" ,
156
+ globalfeatures = runner .runner_features (globals = True ),
157
+ features = runner .runner_features (),
158
+ ),
159
+ # optionally disconnect that first one
160
+ TryAll ([], Disconnect ()),
141
161
Connect (connprivkey = "02" ),
142
162
ExpectMsg ("init" , if_match = no_gf13 ),
143
163
# BOLT #1:
144
164
# The sending node:...
145
165
# - SHOULD NOT set features greater than 13 in `globalfeatures`.
146
- Msg ("init" , globalfeatures = bitfield (99 ), features = "" ),
166
+ Msg (
167
+ "init" ,
168
+ globalfeatures = runner .runner_features (
169
+ globals = True , additional_features = [99 ]
170
+ ),
171
+ features = runner .runner_features (),
172
+ ),
147
173
]
148
174
run_runner (runner , sequences )
149
175
@@ -154,14 +180,24 @@ def test_init_is_first_msg(runner: Runner, namespaceoverride: Any) -> None:
154
180
sequences = [
155
181
Connect (connprivkey = "03" ),
156
182
ExpectMsg ("init" ),
157
- Msg ("init" , globalfeatures = "" , features = "" ),
183
+ Msg (
184
+ "init" ,
185
+ globalfeatures = runner .runner_features (globals = True ),
186
+ features = runner .runner_features (),
187
+ ),
188
+ # optionally disconnect that first one
189
+ TryAll ([], Disconnect ()),
158
190
Connect (connprivkey = "02" ),
159
191
# Minimal possible init message.
160
192
# BOLT #1:
161
193
# The sending node:
162
194
# - MUST send `init` as the first Lightning message for any connection.
163
195
ExpectMsg ("init" ),
164
- Msg ("init" , globalfeatures = "" , features = "" ),
196
+ Msg (
197
+ "init" ,
198
+ globalfeatures = runner .runner_features (globals = True ),
199
+ features = runner .runner_features (),
200
+ ),
165
201
]
166
202
run_runner (runner , sequences )
167
203
@@ -172,15 +208,25 @@ def test_init_check_free_featurebits(runner: Runner, namespaceoverride: Any) ->
172
208
sequences = [
173
209
Connect (connprivkey = "03" ),
174
210
ExpectMsg ("init" ),
175
- Msg ("init" , globalfeatures = "" , features = "" ),
211
+ Msg (
212
+ "init" ,
213
+ globalfeatures = runner .runner_features (globals = True ),
214
+ features = runner .runner_features (),
215
+ ),
216
+ # optionally disconnect that first one
217
+ TryAll ([], Disconnect ()),
176
218
Connect (connprivkey = "02" ),
177
219
ExpectMsg ("init" , if_match = functools .partial (no_feature , [98 , 99 ])),
178
220
# BOLT #1:
179
221
# The receiving node:...
180
222
# - upon receiving unknown _odd_ feature bits that are non-zero:
181
223
# - MUST ignore the bit.
182
224
# init msg with unknown odd local bit (99): no error
183
- Msg ("init" , globalfeatures = "" , features = bitfield (99 )),
225
+ Msg (
226
+ "init" ,
227
+ globalfeatures = runner .runner_features (globals = True ),
228
+ features = runner .runner_features (additional_features = [99 ]),
229
+ ),
184
230
]
185
231
run_runner (runner , sequences )
186
232
@@ -193,14 +239,24 @@ def test_init_fail_connection_if_receive_an_even_unknown_featurebits(
193
239
sequences = [
194
240
Connect (connprivkey = "03" ),
195
241
ExpectMsg ("init" ),
196
- Msg ("init" , globalfeatures = "" , features = "" ),
242
+ Msg (
243
+ "init" ,
244
+ globalfeatures = runner .runner_features (globals = True ),
245
+ features = runner .runner_features (),
246
+ ),
247
+ # optionally disconnect that first one
248
+ TryAll ([], Disconnect ()),
197
249
Connect (connprivkey = "02" ),
198
250
# BOLT #1:
199
251
# The receiving node: ...
200
252
# - upon receiving unknown _even_ feature bits that are non-zero:
201
253
# - MUST fail the connection.
202
254
ExpectMsg ("init" ),
203
- Msg ("init" , globalfeatures = "" , features = bitfield (98 )),
255
+ Msg (
256
+ "init" ,
257
+ globalfeatures = runner .runner_features (globals = True ),
258
+ features = runner .runner_features (additional_features = [98 ]),
259
+ ),
204
260
ExpectDisconnect (),
205
261
]
206
262
run_runner (runner , sequences )
@@ -214,11 +270,23 @@ def test_init_fail_connection_if_receive_an_even_unknown_globalfeaturebits(
214
270
sequences = [
215
271
Connect (connprivkey = "03" ),
216
272
ExpectMsg ("init" ),
217
- Msg ("init" , globalfeatures = "" , features = "" ),
273
+ Msg (
274
+ "init" ,
275
+ globalfeatures = runner .runner_features (globals = True ),
276
+ features = runner .runner_features (),
277
+ ),
278
+ # optionally disconnect that first one
279
+ TryAll ([], Disconnect ()),
218
280
Connect (connprivkey = "02" ),
219
281
# init msg with unknown even global bit (98): you will error
220
282
ExpectMsg ("init" ),
221
- Msg ("init" , globalfeatures = bitfield (98 ), features = "" ),
283
+ Msg (
284
+ "init" ,
285
+ globalfeatures = runner .runner_features (
286
+ globals = True , additional_features = [98 ]
287
+ ),
288
+ features = runner .runner_features (),
289
+ ),
222
290
ExpectDisconnect (),
223
291
]
224
292
run_runner (runner , sequences )
@@ -232,14 +300,24 @@ def test_init_fail_ask_for_option_data_loss_protect(
232
300
sequences = [
233
301
Connect (connprivkey = "03" ),
234
302
ExpectMsg ("init" ),
235
- Msg ("init" , globalfeatures = "" , features = "" ),
303
+ Msg (
304
+ "init" ,
305
+ globalfeatures = runner .runner_features (globals = True ),
306
+ features = runner .runner_features (),
307
+ ),
308
+ # optionally disconnect that first one
309
+ TryAll ([], Disconnect ()),
236
310
Connect (connprivkey = "02" ),
237
311
# If you don't support `option_data_loss_protect`, you will be ok if
238
312
# we ask for it.
239
313
Sequence (
240
314
[
241
315
ExpectMsg ("init" , if_match = functools .partial (no_feature , [0 , 1 ])),
242
- Msg ("init" , globalfeatures = "" , features = bitfield (1 )),
316
+ Msg (
317
+ "init" ,
318
+ globalfeatures = runner .runner_features (globals = True ),
319
+ features = runner .runner_features (additional_features = [1 ]),
320
+ ),
243
321
],
244
322
enable = not runner .has_option ("option_data_loss_protect" ),
245
323
),
@@ -255,7 +333,13 @@ def test_init_advertize_option_data_loss_protect(
255
333
sequences = [
256
334
Connect (connprivkey = "03" ),
257
335
ExpectMsg ("init" ),
258
- Msg ("init" , globalfeatures = "" , features = "" ),
336
+ Msg (
337
+ "init" ,
338
+ globalfeatures = runner .runner_features (globals = True ),
339
+ features = runner .runner_features (),
340
+ ),
341
+ # optionally disconnect that first one
342
+ TryAll ([], Disconnect ()),
259
343
Connect (connprivkey = "02" ),
260
344
# If you support `option_data_loss_protect`, you will advertize it odd.
261
345
Sequence (
@@ -274,7 +358,13 @@ def test_init_required_option_data_loss_protect(
274
358
sequences = [
275
359
Connect (connprivkey = "03" ),
276
360
ExpectMsg ("init" ),
277
- Msg ("init" , globalfeatures = "" , features = "" ),
361
+ Msg (
362
+ "init" ,
363
+ globalfeatures = runner .runner_features (globals = True ),
364
+ features = runner .runner_features (),
365
+ ),
366
+ # optionally disconnect that first one
367
+ TryAll ([], Disconnect ()),
278
368
Connect (connprivkey = "02" ),
279
369
# If you require `option_data_loss_protect`, you will advertize it even.
280
370
Sequence (
@@ -293,7 +383,13 @@ def test_init_reject_option_data_loss_protect_if_not_supported(
293
383
sequences = [
294
384
Connect (connprivkey = "03" ),
295
385
ExpectMsg ("init" ),
296
- Msg ("init" , globalfeatures = "" , features = "" ),
386
+ Msg (
387
+ "init" ,
388
+ globalfeatures = runner .runner_features (globals = True ),
389
+ features = runner .runner_features (),
390
+ ),
391
+ # optionally disconnect that first one
392
+ TryAll ([], Disconnect ()),
297
393
Connect (connprivkey = "02" ),
298
394
# If you don't support `option_anchor_outputs`, you will error if
299
395
# we require it.
@@ -317,7 +413,13 @@ def test_init_advertize_option_anchor_outputs(
317
413
sequences = [
318
414
Connect (connprivkey = "03" ),
319
415
ExpectMsg ("init" ),
320
- Msg ("init" , globalfeatures = "" , features = "" ),
416
+ Msg (
417
+ "init" ,
418
+ globalfeatures = runner .runner_features (globals = True ),
419
+ features = runner .runner_features (),
420
+ ),
421
+ # optionally disconnect that first one
422
+ TryAll ([], Disconnect ()),
321
423
Connect (connprivkey = "02" ),
322
424
# If you support `option_anchor_outputs`, you will advertize it odd.
323
425
Sequence (
@@ -336,7 +438,13 @@ def test_init_required_option_anchor_outputs(
336
438
sequences = [
337
439
Connect (connprivkey = "03" ),
338
440
ExpectMsg ("init" ),
339
- Msg ("init" , globalfeatures = "" , features = "" ),
441
+ Msg (
442
+ "init" ,
443
+ globalfeatures = runner .runner_features (globals = True ),
444
+ features = runner .runner_features (),
445
+ ),
446
+ # optionally disconnect that first one
447
+ TryAll ([], Disconnect ()),
340
448
Connect (connprivkey = "02" ),
341
449
# If you require `option_anchor_outputs`, you will advertize it even.
342
450
Sequence (
@@ -355,7 +463,13 @@ def test_init_advertize_option_static_remotekey(
355
463
sequences = [
356
464
Connect (connprivkey = "03" ),
357
465
ExpectMsg ("init" ),
358
- Msg ("init" , globalfeatures = "" , features = "" ),
466
+ Msg (
467
+ "init" ,
468
+ globalfeatures = runner .runner_features (globals = True ),
469
+ features = runner .runner_features (),
470
+ ),
471
+ # optionally disconnect that first one
472
+ TryAll ([], Disconnect ()),
359
473
Connect (connprivkey = "02" ),
360
474
# BOLT-a12da24dd0102c170365124782b46d9710950ac1 #9:
361
475
# | Bits | Name | ... | Dependencies
0 commit comments