This tests the optional tlv `remote_addr` being passed to a plugin. The optional tlv `remote_addr` should only be visible to the initiator l1.
(node_factory)
| 558 | |
| 559 | |
| 560 | def test_peer_connected_remote_addr(node_factory): |
| 561 | """This tests the optional tlv `remote_addr` being passed to a plugin. |
| 562 | |
| 563 | The optional tlv `remote_addr` should only be visible to the initiator l1. |
| 564 | """ |
| 565 | pluginpath = os.path.join(os.getcwd(), 'tests/plugins/peer_connected_logger_a.py') |
| 566 | l1, l2 = node_factory.get_nodes(2, opts={ |
| 567 | 'plugin': pluginpath, |
| 568 | 'dev-allow-localhost': None}) |
| 569 | l1id = l1.info['id'] |
| 570 | l2id = l2.info['id'] |
| 571 | |
| 572 | l1.connect(l2) |
| 573 | l1log = l1.daemon.wait_for_log(f"peer_connected_logger_a {l2id}") |
| 574 | l2log = l2.daemon.wait_for_log(f"peer_connected_logger_a {l1id}") |
| 575 | |
| 576 | # the log entries are followed by the peer_connected payload as dict {} like: |
| 577 | # {'id': '022d223...', 'direction': 'out', 'addr': '127.0.0.1:35289', |
| 578 | # 'remote_addr': '127.0.0.1:59582', 'features': '8808226aa2'} |
| 579 | l1payload = eval(l1log[l1log.find('{'):]) |
| 580 | l2payload = eval(l2log[l2log.find('{'):]) |
| 581 | |
| 582 | # check that l1 sees its remote_addr as l2 sees l1 |
| 583 | assert(l1payload['remote_addr'] == l2payload['addr']) |
| 584 | assert(not l2payload.get('remote_addr')) # l2 can't see a remote_addr |
| 585 | |
| 586 | |
| 587 | def test_async_rpcmethod(node_factory, executor): |
nothing calls this directly
no test coverage detected