Exemplo n.º 1
0
def step_impl(context):
    from pyethereum.signals import peer_disconnect_requested
    from pyethereum.peermanager import disconnect_requested_handler

    peer_disconnect_requested.disconnect(disconnect_requested_handler)

    def disconnect_requested_handler(sender, peer, forget=False, **kwargs):
        context.peer_manager.remove_peer(peer)
        if forget:
            ipn = (peer.ip, peer.port, peer.node_id)
            if ipn in context.peer_manager._known_peers:
                context.peer_manager._known_peers.remove(ipn)
                context.peer_manager.save_peers()

    peer_disconnect_requested.connect(disconnect_requested_handler)
    context.peer.send_Disconnect(reason='Incompatible network protocols')
Exemplo n.º 2
0
def step_impl(context):
    from pyethereum.signals import peer_disconnect_requested
    from pyethereum.peermanager import disconnect_requested_handler

    peer_disconnect_requested.disconnect(disconnect_requested_handler)

    def disconnect_requested_handler(sender, peer, forget=False, **kwargs):
        context.peer_manager.remove_peer(peer)
        if forget:
            ipn = (peer.ip, peer.port, peer.node_id)
            if ipn in context.peer_manager._known_peers:
                context.peer_manager._known_peers.remove(ipn)
                context.peer_manager.save_peers()

    peer_disconnect_requested.connect(disconnect_requested_handler)
    context.peer.send_Disconnect(                                          
            reason='Incompatible network protocols'
            'expected:{0:#04x} received:{1:#04x}'.format(
                context.packeter.PROTOCOL_VERSION, context.peer_protocol_version))
Exemplo n.º 3
0
def step_impl(context):
    from pyethereum.signals import peer_disconnect_requested
    context.disconnect_requested_handler = mock.MagicMock()
    peer_disconnect_requested.connect(context.disconnect_requested_handler)
Exemplo n.º 4
0
def step_impl(context):
    from pyethereum.signals import peer_disconnect_requested
    context.disconnect_requested_handler = mock.MagicMock()
    peer_disconnect_requested.connect(context.disconnect_requested_handler)