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

Function check_utxos_channel

tests/utils.py:376–408  ·  view source on GitHub ↗
(n, chans, expected, exp_tag_list=None, filter_channel=None)

Source from the content-addressed store, hash-verified

374
375
376def check_utxos_channel(n, chans, expected, exp_tag_list=None, filter_channel=None):
377 tag_list = {}
378 moves = n.rpc.call('listcoinmoves_plugin')['coin_moves']
379
380 utxos = extract_utxos(dedupe_moves(moves))
381
382 if filter_channel:
383 utxos = utxos_for_channel(utxos, filter_channel)
384
385 for tag, evs in expected.items():
386 if tag not in tag_list:
387 u_set = list(utxos.values())[0]
388 elif tag in tag_list:
389 u_set = utxos[tag_list[tag]]
390
391 txid = matchup_events(u_set, evs, chans, tag_list)
392
393 if tag not in tag_list:
394 tag_list[tag] = txid
395
396 # Remove checked set from utxos
397 del utxos[txid]
398
399 # Verify that we went through all of the utxos
400 assert len(utxos) == 0
401
402 # Verify that the expected tags match the found tags
403 if exp_tag_list:
404 for tag, txid in tag_list.items():
405 if tag in exp_tag_list:
406 assert exp_tag_list[tag] == txid
407
408 return tag_list
409
410
411def first_channel_id(n1, n2):

Callers 14

test_addfunds_from_blockFunction · 0.90
test_closing_simpleFunction · 0.90
test_penalty_inhtlcFunction · 0.90
test_penalty_outhtlcFunction · 0.90
test_penalty_rbf_normalFunction · 0.90
test_penalty_rbf_burnFunction · 0.90
test_onchain_timeoutFunction · 0.90

Calls 5

extract_utxosFunction · 0.85
dedupe_movesFunction · 0.85
utxos_for_channelFunction · 0.85
matchup_eventsFunction · 0.85
callMethod · 0.45

Tested by 14

test_addfunds_from_blockFunction · 0.72
test_closing_simpleFunction · 0.72
test_penalty_inhtlcFunction · 0.72
test_penalty_outhtlcFunction · 0.72
test_penalty_rbf_normalFunction · 0.72
test_penalty_rbf_burnFunction · 0.72
test_onchain_timeoutFunction · 0.72