(l1, l2, amount, close_to)
| 1655 | for c in l1.rpc.listpeerchannels(l2.info['id'])['channels']]) |
| 1656 | |
| 1657 | def _fundchannel(l1, l2, amount, close_to): |
| 1658 | l1.rpc.connect(l2.info['id'], 'localhost', l2.port) |
| 1659 | assert(l1.rpc.listpeers()['peers'][0]['id'] == l2.info['id']) |
| 1660 | |
| 1661 | # Make sure both consider any previous channels closed. |
| 1662 | wait_for(lambda: not has_normal_channels(l1, l2)) |
| 1663 | wait_for(lambda: not has_normal_channels(l2, l1)) |
| 1664 | |
| 1665 | _, resp = l1.fundchannel(l2, amount, close_to=close_to) |
| 1666 | if close_to: |
| 1667 | assert resp['close_to'] |
| 1668 | else: |
| 1669 | assert 'close_to' not in resp |
| 1670 | |
| 1671 | for node in [l1, l2]: |
| 1672 | channel = node.rpc.listpeerchannels()['channels'][-1] |
| 1673 | assert amount * 1000 == channel['total_msat'] |
| 1674 | |
| 1675 | def _close(src, dst, addr=None): |
| 1676 | """Close the channel from src to dst, with the specified address. |
no test coverage detected