Ejemplo n.º 1
0
    def __init__(self, host, port, seed):
        self.address = discovery.Address(host, port)

        config = dict(discovery=dict(),
                      node=dict(privkey_hex=crypto.sha3(seed).encode('hex')))
        config_discovery = config['discovery']
        config_discovery['listen_host'] = host
        config_discovery['listen_port'] = port

        app = AppMock()
        app.config = config
        self.protocol = discovery.DiscoveryProtocol(app=app, transport=self)
Ejemplo n.º 2
0
    def __init__(self, host, port, seed):
        self.address = discovery.Address(host, port)

        config = ConfigParser.ConfigParser()
        config.add_section('p2p')
        config.set('p2p', 'listen_host', host)
        config.set('p2p', 'listen_port', str(port))
        config.set('p2p', 'privkey_hex', crypto.sha3(seed).encode('hex'))

        app = AppMock()
        app.config = config
        self.protocol = discovery.DiscoveryProtocol(app=app, transport=self)