MCPcopy Create free account
hub / github.com/ElementsProject/lightning / inspect_check_actual

Function inspect_check_actual

tests/utils.py:341–369  ·  view source on GitHub ↗
(txids, channel_id, actual, exp)

Source from the content-addressed store, hash-verified

339
340
341def inspect_check_actual(txids, channel_id, actual, exp):
342 if len(actual['outputs']) != len(exp):
343 raise ValueError(f"actual outputs != exp. exp: {exp}. actual: {actual['outputs']}")
344
345 for e in exp:
346 # find the event in actual that matches
347 found = False
348 for a in actual['outputs']:
349 if e[0].startswith('cid'):
350 if a['account'] != channel_id:
351 continue
352 elif a['account'] != e[0]:
353 continue
354
355 if e[1][0] != a['output_tag']:
356 continue
357 if e[2]:
358 if e[2][0] != a['spend_tag']:
359 raise ValueError(f'spend_tag mismatch. expected: {e}, actual {a}')
360 txids.append((e[3], a['spending_txid']))
361 elif 'spend_tag' in a:
362 raise ValueError(f'{a} contains "spend_tag", expecting {e}')
363
364 found = True
365 break
366 if not found:
367 raise ValueError(f'Unable to find actual tx {a} in expected {exp}')
368
369 return txids
370
371
372def check_inspect_channel(n, channel_id, expected_txs):

Callers 1

check_inspect_channelFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected