| 374 | |
| 375 | |
| 376 | def 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 | |
| 411 | def first_channel_id(n1, n2): |