| 370 | |
| 371 | |
| 372 | def check_inspect_channel(n, channel_id, expected_txs): |
| 373 | actual_txs = n.rpc.bkpr_inspect(channel_id)['txs'] |
| 374 | # Stash a copy in case we need to print on error/assert at end |
| 375 | _actual_txs = actual_txs |
| 376 | if len(actual_txs) != len(expected_txs.keys()): |
| 377 | raise ValueError(f'count actual_txs != expected exp: {expected_txs}') |
| 378 | # start at the top |
| 379 | exp = list(expected_txs.values())[0] |
| 380 | actual = actual_txs[0] |
| 381 | |
| 382 | txids = [] |
| 383 | |
| 384 | exp_counter = 1 |
| 385 | inspect_check_actual(txids, channel_id, actual, exp) |
| 386 | actual_txs.remove(actual) |
| 387 | |
| 388 | for (marker, txid) in txids: |
| 389 | actual = None |
| 390 | for a in actual_txs: |
| 391 | if a['txid'] == txid: |
| 392 | actual = a |
| 393 | break |
| 394 | if not actual: |
| 395 | raise ValueError(f'No "actual" tx found, looking for {txid}. {actual_txs}') |
| 396 | exp = expected_txs[marker] |
| 397 | inspect_check_actual(txids, channel_id, actual, exp) |
| 398 | |
| 399 | # after we've inspected it, remove it |
| 400 | actual_txs.remove(actual) |
| 401 | exp_counter += 1 |
| 402 | |
| 403 | # Did we inspect everything? |
| 404 | if len(actual_txs) != 0: |
| 405 | raise ValueError(f'Had more txs than expected. expected: {expected_txs}. actual: {_actual_txs}') |
| 406 | if exp_counter != len(expected_txs.keys()): |
| 407 | raise ValueError(f'Had less txs than expected. expected: {expected_txs}. actual txs: {_actual_txs}') |
| 408 | |
| 409 | |
| 410 | def check_utxos_channel(n, chans, expected, exp_tag_list=None, filter_channel=None): |