コード例 #1
0
def step_impl(context):
    from pyethereum.signals import peer_addresses_received
    from pyethereum.peermanager import peer_addresses_received_handler

    peer_addresses_received.disconnect(peer_addresses_received_handler)

    def peer_addresses_received_handler(sender, addresses, **kwargs):
        for address in addresses:
            context.peer_manager.add_known_peer_address(*address)
        context.peer_manager.save_peers()
    peer_addresses_received.connect(peer_addresses_received_handler)

    context.peers_to_send = [('9.8.7.6', 3000, 'him'), ('10.9.8.7', 4000, 'her'), ('12.11.10.9', 5000, 'she')]
    context.packet = context.packeter.dump_Peers(context.peers_to_send)
    decoded_packet = context.packeter.load_packet(context.packet)[1][3]
    context.peer._recv_Peers(decoded_packet)
コード例 #2
0
def step_impl(context):
    context.new_peer_received_handler = mock.MagicMock()
    from pyethereum.signals import peer_addresses_received
    peer_addresses_received.connect(context.new_peer_received_handler)
コード例 #3
0
ファイル: peer.py プロジェクト: CJentzsch/pyethereum
def step_impl(context):
    context.new_peer_received_handler = mock.MagicMock()
    from pyethereum.signals import peer_addresses_received
    peer_addresses_received.connect(context.new_peer_received_handler)