(l1, l2, amount, close_to)
| 1600 | for c in only_one(l1.rpc.listpeers(l2.info['id'])['peers'])['channels']]) |
| 1601 | |
| 1602 | def _fundchannel(l1, l2, amount, close_to): |
| 1603 | l1.rpc.connect(l2.info['id'], 'localhost', l2.port) |
| 1604 | assert(l1.rpc.listpeers()['peers'][0]['id'] == l2.info['id']) |
| 1605 | |
| 1606 | # Make sure both consider any previous channels closed. |
| 1607 | wait_for(lambda: not has_normal_channels(l1, l2)) |
| 1608 | wait_for(lambda: not has_normal_channels(l2, l1)) |
| 1609 | |
| 1610 | _, resp = l1.fundchannel(l2, amount, close_to=close_to) |
| 1611 | if close_to: |
| 1612 | assert resp['close_to'] |
| 1613 | else: |
| 1614 | assert 'close_to' not in resp |
| 1615 | |
| 1616 | for node in [l1, l2]: |
| 1617 | channel = node.rpc.listpeers()['peers'][0]['channels'][-1] |
| 1618 | assert amount * 1000 == channel['total_msat'] |
| 1619 | |
| 1620 | def _close(src, dst, addr=None): |
| 1621 | """Close the channel from src to dst, with the specified address. |
no test coverage detected