Esempio n. 1
0
def step_impl(context):
    # a random peer with connection port and no id
    context.peer_data = (utils.mock_connection(), '4.5.6.7', 55555)
    context.peer = context.peer_manager._start_peer(*context.peer_data)
    context.peer.node_id = ""

    context.packeter.NODE_ID = 'this is a different node id'
Esempio n. 2
0
def step_impl(context):
    context.peer_manager.add_peer(utils.mock_connection(), '127.0.0.1', 1234)
    context.peer_manager.add_peer(utils.mock_connection(), '1.1.1.1', 1234)
Esempio n. 3
0
def step_impl(context):
    context.peer_data = (utils.mock_connection(), '127.0.0.1', 1234)
Esempio n. 4
0
def step_impl(context):
    context.peer_data = (utils.mock_connection(), '100.100.100.100', 10001)
Esempio n. 5
0
def step_impl(context):
    context.peer_manager._known_peers = set([('12.13.14.15', 2002, "him"), ('14.15.16.17', 3003, "her")])
    ip, port, nid = context.peer_manager._known_peers.pop()
    context.peer_data = (utils.mock_connection(), ip, port)
Esempio n. 6
0
def step_impl(context):
    context.peer_data = (utils.mock_connection(), '4.5.6.7', 55555)
    context.peer = context.peer_manager.add_peer(*context.peer_data)
    context.ipn = (context.peer.ip, context.peer.port, context.peer.node_id)
    context.peer_manager._known_peers.add(context.ipn)
    context.peer_protocol_version = 0xff
Esempio n. 7
0
def step_impl(context):
    from pyethereum.peer import Peer
    context.peer_manager.connected_peers = [
        Peer(utils.mock_connection(), '1.1.1.1', 1234),
        Peer(utils.mock_connection(), '2.1.1.1', 1234),
    ]
Esempio n. 8
0
def step_impl(context):
    from pyethereum.peer import Peer
    context.peer = Peer(utils.mock_connection(), '1.1.1.1', 1234)
    context.peer.send_Ping = mock.MagicMock()
Esempio n. 9
0
def step_impl(context):
    context.peer_manager.connected_peers = []
    for ip, port, node_id in context.peer_addresses:
        peer = utils.mock_peer(utils.mock_connection(), ip, port)
        peer.node_id = node_id
        context.peer_manager.connected_peers.append(peer)
Esempio n. 10
0
 def before_feature(self, context, feature):
     from pyethereum.packeter import packeter
     context.packeter = packeter
     packeter.configure(context.conf)
     context._connection = utils.mock_connection()